mirror of https://github.com/rxi/json.lua.git
Merge pull request #15 from nikeinikei/master
Fix serializing of tables with overloaded indexing / using __index metamethodpull/18/head
commit
f049daf06c
2
json.lua
2
json.lua
|
@ -65,7 +65,7 @@ local function encode_table(val, stack)
|
||||||
|
|
||||||
stack[val] = true
|
stack[val] = true
|
||||||
|
|
||||||
if val[1] ~= nil or next(val) == nil then
|
if rawget(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
|
||||||
|
|
Loading…
Reference in New Issue