Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cjson & dkjson incorrectly parse saved json if the key only consists of numbers. #42

Open
HotaruBlaze opened this issue Oct 20, 2023 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@HotaruBlaze
Copy link

HotaruBlaze commented Oct 20, 2023

If a key only consists of numbers, such as if a players name is "12345", when loading the json into lua, it will be parsed as a number, instead of a string, this can cause issues due to scripts using below, expecting it to be the string they saved, not being a number.

exampleTable[tostring("12345")] = true

This will break when you restart the server, as the libs will parse this as a number and not a string.

we may want to add a form of handler for this or look into a way to fix this.

image

@HotaruBlaze HotaruBlaze added bug Something isn't working help wanted Extra attention is needed labels Oct 20, 2023
@magicaldave
Copy link
Member

What's the status on this as it relates to corescripts now that #47 is in?

@HotaruBlaze
Copy link
Author

HotaruBlaze commented Oct 23, 2023

its a bandaid function to handle the number/string mismatch, the issue still exists in the lib level, however from what I can tell, CoreScripts shouldnt encounter it by default, its more likely to be issues on the custom scripter level

from what I could tell, it should be possible to teach dkjson to handle it, However its also slower and the most you could do is invert the issue where numbers you expect are a string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants