callback within a timed loop

Go To StackoverFlow.com

1

I want to have a timed loop that contains a callback function. The callback function should only be callable within the time period

function my_callback( )
    ....
end


setCallback("my_callback")

time_limit = os.time() + 20

while (os.time() < time_limit) do

 -- I want my_callback to be callable in this loop for 20 seconds only

end

What is a proper way to get this effect

2012-04-03 23:58
by veccy


0

I'm not sure what you need but check out lalarm and luasignal.

2012-04-04 01:57
by lhf