Added argument type-checking to json.decode()

pull/6/head
rxi 2015-09-06 14:07:28 +01:00
parent 89b0e905ef
commit bf3ebf6679
1 changed files with 3 additions and 0 deletions

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