Added argument type-checking to json.decode()

This commit is contained in:
rxi
2015-09-06 14:07:28 +01:00
parent 89b0e905ef
commit bf3ebf6679

View File

@@ -370,6 +370,9 @@ end
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)) )
end