mirror of https://github.com/rxi/json.lua.git
Added argument type-checking to json.decode()
parent
89b0e905ef
commit
bf3ebf6679
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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue