mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
Allow minetest.after to take a variable number of arguments
This commit is contained in:
parent
10c03e1a9d
commit
fc5d2074b9
@ -14,14 +14,14 @@ minetest.register_globalstep(function(dtime)
|
|||||||
for index, timer in ipairs(minetest.timers) do
|
for index, timer in ipairs(minetest.timers) do
|
||||||
timer.time = timer.time - dtime
|
timer.time = timer.time - dtime
|
||||||
if timer.time <= 0 then
|
if timer.time <= 0 then
|
||||||
timer.func(timer.param)
|
timer.func(unpack(timer.args))
|
||||||
table.remove(minetest.timers,index)
|
table.remove(minetest.timers,index)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function minetest.after(time, func, param)
|
function minetest.after(time, func, ...)
|
||||||
table.insert(minetest.timers_to_add, {time=time, func=func, param=param})
|
table.insert(minetest.timers_to_add, {time=time, func=func, args=arg})
|
||||||
end
|
end
|
||||||
|
|
||||||
function minetest.check_player_privs(name, privs)
|
function minetest.check_player_privs(name, privs)
|
||||||
|
@ -977,9 +977,9 @@ minetest.sound_play(spec, parameters) -> handle
|
|||||||
minetest.sound_stop(handle)
|
minetest.sound_stop(handle)
|
||||||
|
|
||||||
Timing:
|
Timing:
|
||||||
minetest.after(time, func, param)
|
minetest.after(time, func, ...)
|
||||||
^ Call function after time seconds
|
^ Call function after time seconds
|
||||||
^ param is optional; to pass multiple parameters, pass a table.
|
^ Optional: Variable number of arguments that are passed to func
|
||||||
|
|
||||||
Server:
|
Server:
|
||||||
minetest.request_shutdown() -> request for server shutdown
|
minetest.request_shutdown() -> request for server shutdown
|
||||||
|
Loading…
Reference in New Issue
Block a user