1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Luanti rename: builtin (#15324)

This commit is contained in:
Wuzzy 2024-10-28 19:40:18 +01:00 committed by GitHub
parent 409e75b94d
commit ad4b13a0e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
69 changed files with 77 additions and 112 deletions

View file

@ -204,18 +204,18 @@ local function dummy_func() end
function core.deserialize(str, safe)
-- Backwards compatibility
if str == nil then
core.log("deprecated", "minetest.deserialize called with nil (expected string).")
core.log("deprecated", "core.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))
error(("core.deserialize called with %s (expected string)."):format(t))
end
local func, err = loadstring(str)
if not func then return nil, err end
-- math.huge was serialized to inf and NaNs to nan by Lua in Minetest 5.6, so we have to support this here
-- math.huge was serialized to inf and NaNs to nan by Lua in engine version 5.6, so we have to support this here
local env = {inf = math_huge, nan = 0/0}
if safe then
env.loadstring = dummy_func