Skip to content

Commit

Permalink
fix array detection when using overloaded indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
nikeinikei committed Jan 11, 2019
1 parent bee7ee3 commit d3f417d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion json.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ local function encode_table(val, stack)

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
local n = 0
for k in pairs(val) do
Expand Down

0 comments on commit d3f417d

Please sign in to comment.