mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-12-25 23:17:28 +01:00
Add option to disable printing inside a luacontroller (#633)
Co-authored-by: DS <vorunbekannt75@web.de>
This commit is contained in:
parent
2589b391e5
commit
6890624f3d
@ -203,12 +203,14 @@ end
|
|||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
local function safe_print(param)
|
local function safe_print(param)
|
||||||
|
if mesecon.setting("luacontroller_print_behavior", "log") == "log" then
|
||||||
local string_meta = getmetatable("")
|
local string_meta = getmetatable("")
|
||||||
local sandbox = string_meta.__index
|
local sandbox = string_meta.__index
|
||||||
string_meta.__index = string -- Leave string sandbox temporarily
|
string_meta.__index = string -- Leave string sandbox temporarily
|
||||||
print(dump(param))
|
minetest.log("action", string.format("[mesecons_luacontroller] print(%s)", dump(param)))
|
||||||
string_meta.__index = sandbox -- Restore string sandbox
|
string_meta.__index = sandbox -- Restore string sandbox
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function safe_date()
|
local function safe_date()
|
||||||
return(os.date("*t",os.time()))
|
return(os.date("*t",os.time()))
|
||||||
|
@ -28,6 +28,10 @@ mesecon.luacontroller_memsize (Controller memory limit) int 100000 10000 1000000
|
|||||||
# IID is ignored and at most one interrupt may be queued if this setting is enabled.
|
# IID is ignored and at most one interrupt may be queued if this setting is enabled.
|
||||||
mesecon.luacontroller_lightweight_interrupts (Lightweight interrupts) bool false
|
mesecon.luacontroller_lightweight_interrupts (Lightweight interrupts) bool false
|
||||||
|
|
||||||
|
# Behavior of print() inside a luacontroller. By default, this emits a message into actionstream.
|
||||||
|
# Set it to noop if you wish to disable that behavior.
|
||||||
|
mesecon.luacontroller_print_behavior (Behavior of print) enum log log,noop
|
||||||
|
|
||||||
[mesecons_mvps]
|
[mesecons_mvps]
|
||||||
|
|
||||||
# In pre-existing world, MVPS may not be labelled with the owner.
|
# In pre-existing world, MVPS may not be labelled with the owner.
|
||||||
|
Loading…
Reference in New Issue
Block a user