Updated pairs to avoid using __pairs in Lua 5.2+.

Ref pkulchenko/MobDebug#27, pkulchenko/MobDebug#29.
This commit is contained in:
Paul Kulchenko 2017-09-01 21:28:48 -07:00
parent 679a5a3bca
commit 10be108506

View File

@ -1,8 +1,9 @@
local n, v = "serpent", "0.29" -- (C) 2012-17 Paul Kulchenko; MIT License
local n, v = "serpent", "0.291" -- (C) 2012-17 Paul Kulchenko; MIT License
local c, d = "Paul Kulchenko", "Lua serializer and pretty printer"
local snum = {[tostring(1/0)]='1/0 --[[math.huge]]',[tostring(-1/0)]='-1/0 --[[-math.huge]]',[tostring(0/0)]='0/0'}
local badtype = {thread = true, userdata = true, cdata = true}
local getmetatable = debug and debug.getmetatable or getmetatable
local pairs = function(t) return next, t end -- avoid using __pairs in Lua 5.2+
local keyword, globals, G = {}, {}, (_G or _ENV)
for _,k in ipairs({'and', 'break', 'do', 'else', 'elseif', 'end', 'false',
'for', 'function', 'goto', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat',