Added "unsupported type" error to lume.serialize()

The unsupported type error is raised if an unsupported type is
encountered in the table we are trying to serialize.
This commit is contained in:
rxi 2014-03-12 21:12:16 +00:00
parent fcb1fa90d4
commit cbafc49e8a

View File

@ -245,6 +245,8 @@ function lume.serialize(x)
end
return "{" .. table.concat(rtn) .. "}"
end
local err = function(t,k) error("unsupported serialize type: " .. k) end
setmetatable(f, { __index = err })
return f[type(x)](x)
end