mirror of
https://github.com/TangentFoxy/rxi-json.lua.git
synced 2025-07-28 02:52:17 +00:00
Changed empty table to be treated as array when encoding
This commit is contained in:
2
json.lua
2
json.lua
@@ -50,7 +50,7 @@ local function encode_table(val, stack)
|
|||||||
|
|
||||||
stack[val] = true
|
stack[val] = true
|
||||||
|
|
||||||
if val[1] ~= nil then
|
if val[1] ~= nil or next(val) == nil then
|
||||||
-- Treat as array -- check keys are valid and it is not sparse
|
-- Treat as array -- check keys are valid and it is not sparse
|
||||||
local n = 0
|
local n = 0
|
||||||
for k in pairs(val) do
|
for k in pairs(val) do
|
||||||
|
Reference in New Issue
Block a user