mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-12-28 00:07:29 +01:00
Fix Luacontroller’s print() (#422)
Because of working inside the sandbox, it was unable to print tables.
This commit is contained in:
parent
334400a541
commit
d4e05f33af
@ -198,7 +198,11 @@ end
|
|||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
local function safe_print(param)
|
local function safe_print(param)
|
||||||
|
local string_meta = getmetatable("")
|
||||||
|
local sandbox = string_meta.__index
|
||||||
|
string_meta.__index = string -- Leave string sandbox temporarily
|
||||||
print(dump(param))
|
print(dump(param))
|
||||||
|
string_meta.__index = sandbox -- Restore string sandbox
|
||||||
end
|
end
|
||||||
|
|
||||||
local function safe_date()
|
local function safe_date()
|
||||||
|
Loading…
Reference in New Issue
Block a user