mirror of
https://github.com/pkulchenko/serpent.git
synced 2024-10-10 13:14:17 +00:00
Fixed an issue with luaffi that returns getmetatable(ffi.C)
as true
.
This commit is contained in:
parent
0c1483c799
commit
2d09171357
@ -1,4 +1,4 @@
|
|||||||
local n, v = "serpent", 0.23 -- (C) 2012-13 Paul Kulchenko; MIT License
|
local n, v = "serpent", 0.231 -- (C) 2012-13 Paul Kulchenko; MIT License
|
||||||
local c, d = "Paul Kulchenko", "Lua serializer and pretty printer"
|
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 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 badtype = {thread = true, userdata = true, cdata = true}
|
||||||
@ -46,7 +46,7 @@ local function s(t, opts)
|
|||||||
if seen[t] then -- already seen this element
|
if seen[t] then -- already seen this element
|
||||||
table.insert(sref, spath..space..'='..space..seen[t])
|
table.insert(sref, spath..space..'='..space..seen[t])
|
||||||
return tag..'nil'..comment('ref', level) end
|
return tag..'nil'..comment('ref', level) end
|
||||||
if mt and (mt.__serialize or mt.__tostring) then -- knows how to serialize itself
|
if type(mt) == 'table' and (mt.__serialize or mt.__tostring) then -- knows how to serialize itself
|
||||||
seen[t] = insref or spath
|
seen[t] = insref or spath
|
||||||
if mt.__serialize then t = mt.__serialize(t) else t = tostring(t) end
|
if mt.__serialize then t = mt.__serialize(t) else t = tostring(t) end
|
||||||
ttype = type(t) end -- new value falls through to be serialized
|
ttype = type(t) end -- new value falls through to be serialized
|
||||||
|
Loading…
Reference in New Issue
Block a user