From 5746ae652d1bed1ced7ee468ba25234b16ffed9e Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Tue, 3 May 2022 17:58:08 +0200 Subject: [PATCH] Updated Timer (markdown) --- Timer.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/Timer.md b/Timer.md index 6d3f665..e799b29 100644 --- a/Timer.md +++ b/Timer.md @@ -1 +1,49 @@ -WIP \ No newline at end of file +With timers you can call delayed functions. +
+Here is a list of all available functions for timers:
+ +## setTime +sets the time the timer should wait after calling your function +````lua +local mainFrame = basalt.createFrame("myFirstFrame"):show() +local aTimer = mainFrame:addTimer("myFirstTimer"):show() +aTimer:setTime(5) +```` +**parameters:**number time[, number repeats] - (time in seconds, if repeats is -1 it will call the function infinitly (every x seconds)
+**returns:** self
+ +## start +starts the timer +````lua +local mainFrame = basalt.createFrame("myFirstFrame"):show() +local aTimer = mainFrame:addTimer("myFirstTimer"):show() +aTimer:setTime(5):start() +```` +**parameters:** -
+**returns:** self
+ +## cancel +stops/cancels the timer +````lua +local mainFrame = basalt.createFrame("myFirstFrame"):show() +local aTimer = mainFrame:addTimer("myFirstTimer"):show() +aTimer:setTime(5):start() +aTimer:cancel() +```` +**parameters:** -
+**returns:** self
+ + +## onCall +adds a function to the timer +````lua +local function timerCall(self) + basalt.debug("i got called!") +end +local mainFrame = basalt.createFrame("myFirstFrame"):show() +local aTimer = mainFrame:addTimer("myFirstTimer"):show() +aTimer:setTime(5):onCall(timerCall):start() + +```` +**parameters:** function func
+**returns:** self