Skip to content

Commit f049daf

Browse files
authored
Merge pull request #15 from nikeinikei/master
Fix serializing of tables with overloaded indexing / using __index metamethod
2 parents bee7ee3 + fd58f29 commit f049daf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

json.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ local function encode_table(val, stack)
6565

6666
stack[val] = true
6767

68-
if val[1] ~= nil or next(val) == nil then
68+
if rawget(val, 1) ~= nil or next(val) == nil then
6969
-- Treat as array -- check keys are valid and it is not sparse
7070
local n = 0
7171
for k in pairs(val) do

0 commit comments

Comments
 (0)