diff --git a/json.lua b/json.lua index 16c232d..0f724d5 100644 --- a/json.lua +++ b/json.lua @@ -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