03.07.2015, 17:34
v0.1.2 (Alpha) released:
- setTimer, killTimer function added.
- New arguments reader added.
- Fixed various issues with using function reader.
Syntax (setTimer):
Syntax (killTimer):
Examples of using setTimer, killTimer:
- setTimer, killTimer function added.
- New arguments reader added.
- Fixed various issues with using function reader.
Syntax (setTimer):
Код:
timerid setTimer(interval, repeat, function [,arguments...])
- interval - Interval in milliseconds
- repeat - If this set to true it will loop until you destroy it (with killTimer), if it set to false it will only call once the function.
- function - The function you want to call
- arguments - It's only used when you want to pass some variable
Syntax (killTimer):
Код:
bool killTimer(timerid)
- timerid - the ID of the timer you want to kill
Examples of using setTimer, killTimer:
Код:
local timerid = setTimer(1000, true, function(number, str, bool) print(string.format("Test (1 sec): %d, %s, %s", number, str, tostring(bool))) end, 10, "Test", true) killTimer(timerid)
Код:
function testTimer(number, str, bool) print(string.format("Test (1 sec): %d, %s, %s", number, str, tostring(bool))) end setTimer(1000, true, testTimer, 10, "Teszt", true)
Код:
setTimer(1000, false, function() --do something here end)
Код:
function testTimer() --do something here every 1sec end setTimer(1000, true, testTimer)