diff --git a/Timer.md b/Timer.md index a5a67b9..e8eff51 100644 --- a/Timer.md +++ b/Timer.md @@ -9,7 +9,7 @@ The Timer module lets you execute pieces of script with a delay and optionally m Creates and starts a timer using the given variables. #### Syntax: ```lua -timer SetTimer(function function, int interval, int timesToExecute, [params]); +timer SetTimer(function function, int interval, int timesToExecute, [params]) ``` ##### Required arguments - **function:** A LUA function to be called each time the timer ticks @@ -23,38 +23,38 @@ timer SetTimer(function function, int interval, int timesToExecute, [params]); #### Example: ```lua -- Simple example without passing arguments -local helloAmount = 1; +local helloAmount = 1 function timedHello() - print("Hello! " .. helloAmount); - helloAmount = helloAmount + 1; + print("Hello! " .. helloAmount) + helloAmount = helloAmount + 1 end -Timer.SetTimer(timedHello, 1000, 5); +Timer.SetTimer(timedHello, 1000, 5) -- Example with passing arguments -local printAmount = 1; +local printAmount = 1 function timedPrint(text) - print(text .. printAmount); - printAmount = printAmount + 1; + print(text .. printAmount) + printAmount = printAmount + 1 end -Timer.SetTimer(timedPrint, 1000, 5, "Hello! "); +Timer.SetTimer(timedPrint, 1000, 5, "Hello! ") ``` --- ### RemoveTimer Removes an existing timer. ```lua -RemoveTimer(timer timer); +RemoveTimer(timer timer) ``` ##### Required arguments - **timer:** The timer to remove #### Example: ```lua -local helloTimer; +local helloTimer function timedHello() - print("Hello!"); - -- Stop the timer after running once - Timer.RemoveTimer(helloTimer); + print("Hello!") + -- Stop the timer after running once + Timer.RemoveTimer(helloTimer) end -helloTimer = Timer.SetTimer(timedHello, 1000, 5); +helloTimer = Timer.SetTimer(timedHello, 1000, 5) ``` --- \ No newline at end of file