mirror of
https://github.com/TangentFoxy/rxi-json.lua.git
synced 2025-07-28 02:52:17 +00:00
Added argument type-checking to json.decode()
This commit is contained in:
3
json.lua
3
json.lua
@@ -370,6 +370,9 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function json.decode(str)
|
function json.decode(str)
|
||||||
|
if type(str) ~= "string" then
|
||||||
|
error("expected argument of type string, got " .. type(str))
|
||||||
|
end
|
||||||
return ( parse(str, next_char(str, 1, space_chars, true)) )
|
return ( parse(str, next_char(str, 1, space_chars, true)) )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user