mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-09-27 23:00:29 +02:00
Let it complain on invalid arguments
This commit is contained in:
parent
2b9c4ffaee
commit
3e3f5fb93e
|
@ -271,8 +271,9 @@ local get_interrupt
|
||||||
if mesecon.setting("luacontroller_lightweight_interrupts", false) then
|
if mesecon.setting("luacontroller_lightweight_interrupts", false) then
|
||||||
-- use node timer
|
-- use node timer
|
||||||
get_interrupt = function(pos, itbl, send_warning)
|
get_interrupt = function(pos, itbl, send_warning)
|
||||||
return (function(time)
|
return (function(time, iid)
|
||||||
if type(time) ~= "number" then return end
|
if type(time) ~= "number" then error("Delay must be a number") end
|
||||||
|
if iid ~= nil then send_warning("Interrupt IDs are disabled on this server") end
|
||||||
table.insert(itbl, function() minetest.get_node_timer(pos):start(time) end)
|
table.insert(itbl, function() minetest.get_node_timer(pos):start(time) end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
@ -284,7 +285,7 @@ else
|
||||||
local function interrupt(time, iid)
|
local function interrupt(time, iid)
|
||||||
-- NOTE: This runs within string metatable sandbox, so don't *rely* on anything of the form (""):y
|
-- NOTE: This runs within string metatable sandbox, so don't *rely* on anything of the form (""):y
|
||||||
-- Hence the values get moved out. Should take less time than original, so totally compatible
|
-- Hence the values get moved out. Should take less time than original, so totally compatible
|
||||||
if type(time) ~= "number" then return end
|
if type(time) ~= "number" then error("Delay must be a number") end
|
||||||
table.insert(itbl, function ()
|
table.insert(itbl, function ()
|
||||||
-- Outside string metatable sandbox, can safely run this now
|
-- Outside string metatable sandbox, can safely run this now
|
||||||
local luac_id = minetest.get_meta(pos):get_int("luac_id")
|
local luac_id = minetest.get_meta(pos):get_int("luac_id")
|
||||||
|
@ -662,7 +663,7 @@ local function reset(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function node_timer(pos)
|
local function node_timer(pos)
|
||||||
if (minetest.registered_nodes[minetest.get_node(pos).name].is_burnt) then
|
if minetest.registered_nodes[minetest.get_node(pos).name].is_burnt then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
run(pos, {type="interrupt"})
|
run(pos, {type="interrupt"})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user