aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/common/serialize.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin/common/serialize.lua b/builtin/common/serialize.lua
index 6278e2739..caf989e69 100644
--- a/builtin/common/serialize.lua
+++ b/builtin/common/serialize.lua
@@ -188,6 +188,16 @@ local function dummy_func() end
local nan = (0/0)^1 -- +nan
function core.deserialize(str, safe)
+ -- Backwards compatibility
+ if str == nil then
+ core.log("deprecated", "minetest.deserialize called with nil (expected string).")
+ return nil, "Invalid type: Expected a string, got nil"
+ end
+ local t = type(str)
+ if t ~= "string" then
+ error(("minetest.deserialize called with %s (expected string)."):format(t))
+ end
+
local func, err = loadstring(str)
if not func then return nil, err end