mirror of
https://github.com/TangentFoxy/lume.git
synced 2024-11-19 07:04:24 +00:00
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:
parent
fcb1fa90d4
commit
cbafc49e8a
2
lume.lua
2
lume.lua
@ -245,6 +245,8 @@ function lume.serialize(x)
|
|||||||
end
|
end
|
||||||
return "{" .. table.concat(rtn) .. "}"
|
return "{" .. table.concat(rtn) .. "}"
|
||||||
end
|
end
|
||||||
|
local err = function(t,k) error("unsupported serialize type: " .. k) end
|
||||||
|
setmetatable(f, { __index = err })
|
||||||
return f[type(x)](x)
|
return f[type(x)](x)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user