Fix JsonEncode treating tables with index 0 as arrays#454
Fix JsonEncode treating tables with index 0 as arrays#454Kipstz wants to merge 2 commits intoBeamMP:minorfrom
Conversation
Tables with index 0 should be encoded as JSON objects, not arrays. Lua arrays start at index 1, so any table with keys outside 1-N range should be treated as an object. Added IsLuaArray() helper that checks all keys are integers >= 1. Closes BeamMP#348
|
The issue also mentions this related behaviour:
Would you mind attempting to fix this as well in this pr? |
Yes, I can. I'll look at this tomorrow. |
Summary
Util.JsonEncodeincorrectly encoding Lua tables with index 0 as JSON arraysIsLuaArray()helper function that validates all keys are integers >= 1Closes #348
Before
After