Code: Select all
function love.load()
tmr=4
end
-- function "timer" is called from love.update(dt):
-- The function print('Hi') prints the word "Hi"
function love.update(dt)
timer(tmr,print('Hi'),dt)
end
-- the timer counts back and when it reaches 0, the function print('Hi') should be performed from an argument "func"
function timer(timer,func,dt)
if timer>0 then
timer=timer-1*dt
if timer<=0 then
return func
end
end
tmr=timer
end