I need to be able to create a timer that calls a function with multiple parameters but it doesn't work because after the first parameter the next one goes into the count parameter.
1
timer(1000,"meditateStage2",id,x,y)
Any help will be appreciated.
Scripts
Multiple Parameters in a Timer.
Multiple Parameters in a Timer.
1

timer(1000,"meditateStage2",id,x,y)
timers = {}
function advtmr(time,func,var)
if not time then	for k,v in pairs(timers) do	timers[k] = 1	end	return	end
local ar
for i = 1,#timers+1 do	if not timers[i] then	ar = i	break	end	end
timers[ar] = {f = func,v = var}
timer(time,"exectimer",ar)
end
function exectimer(array)
local ar = tonumber(array)
if not timers[ar] then	return
elseif type(timers[ar]) == "table" then	timers[ar].f(timers[ar].v and unpack(timers[ar].v))
end
timers[ar] = nil
end
EnderCrypt's
Speedfreak has writtentimers = {}
function advtmr(time,func,var)
if not time then	for k,v in pairs(timers) do	timers[k] = 1	end	return	end
local ar
for i = 1,#timers+1 do	if not timers[i] then	ar = i	break	end	end
timers[ar] = {f = func,v = var}
timer(time,"exectimer",ar)
end
function exectimer(array)
local ar = tonumber(array)
if not timers[ar] then	return
elseif type(timers[ar]) == "table" then	timers[ar].f(timers[ar].v and unpack(timers[ar].v))
end
timers[ar] = nil
end
LUA ERROR: sys/lua/Master_Yi/main.lua:58: attempt to call field 'f' (a string value)
timers[ar].f(timers[ar].v and unpack(timers[ar].v))
VADemon has written
timer
function example(a,b) timer(1000,"parse","lua example2(a,b)",0) end function example2(a,b) --some code end
Nekomata: & @
VADemon: Thanks it works
Bowlinghead: Are you really sure that will work? What about this one: function example(a,b)
timer(1000,"parse","lua example2("..a..", "..b..")",0)
end
1
