From 2d09171357c14839d213d36f96f0aa34da23735d Mon Sep 17 00:00:00 2001 From: Paul Kulchenko Date: Tue, 11 Jun 2013 00:02:22 -0700 Subject: [PATCH] Fixed an issue with luaffi that returns `getmetatable(ffi.C)` as `true`. --- src/serpent.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/serpent.lua b/src/serpent.lua index d03af40..01a2e8b 100644 --- a/src/serpent.lua +++ b/src/serpent.lua @@ -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 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} @@ -46,7 +46,7 @@ local function s(t, opts) if seen[t] then -- already seen this element table.insert(sref, spath..space..'='..space..seen[t]) 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 if mt.__serialize then t = mt.__serialize(t) else t = tostring(t) end ttype = type(t) end -- new value falls through to be serialized