DreamWeave-MP / CoreScripts

The serverside Lua scripts used to implement core functionality in S3MP.
MIT License
0 stars 1 forks source link

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

Open HotaruBlaze opened 1 year ago

HotaruBlaze commented 1 year ago

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

magicaldave commented 1 year ago

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

HotaruBlaze commented 1 year ago

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