mirror of
https://github.com/TangentFoxy/lume.git
synced 2025-07-28 11:02:20 +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:
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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user