From bf3ebf6679e8b5e7b443c5924e8aa2afcb66a3e8 Mon Sep 17 00:00:00 2001 From: rxi Date: Sun, 6 Sep 2015 14:07:28 +0100 Subject: [PATCH] Added argument type-checking to json.decode() --- json.lua | 3 +++ 1 file changed, 3 insertions(+) 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