bad syntax fix #2

This commit is contained in:
Samuel Pizette
2022-06-09 11:09:04 -04:00
parent 332be95285
commit 64e7d777c1

View File

@@ -3,7 +3,7 @@ You question yourself how you can execute your own logic while basalt is also ac
## Method 1: ## Method 1:
Using parallel.waitForAll Using parallel.waitForAll
````lua ```lua
local basalt = dofile("basalt.lua") local basalt = dofile("basalt.lua")
local mainFrame = basalt.createFrame("mainFrame"):show()-- lets create a frame and a button without functionality local mainFrame = basalt.createFrame("mainFrame"):show()-- lets create a frame and a button without functionality
@@ -17,13 +17,13 @@ local function yourCustomHandler()
end end
parallel.waitForAll(basalt.autoUpdate, yourCustomHandler) -- here it will handle your function (yourCustomHandler) and basalts handlers at the time parallel.waitForAll(basalt.autoUpdate, yourCustomHandler) -- here it will handle your function (yourCustomHandler) and basalts handlers at the time
```` ```
You can read [here (tweaked.cc)](https://tweaked.cc/module/parallel.html) what exactly parallel.waitForAll() does You can read [here (tweaked.cc)](https://tweaked.cc/module/parallel.html) what exactly parallel.waitForAll() does
## Method 2: ## Method 2:
Using threads Using threads
````lua ```lua
local basalt = dofile("basalt.lua") local basalt = dofile("basalt.lua")
local mainFrame = basalt.createFrame("mainFrame"):show()-- lets create a frame, a button without functionality and a thread local mainFrame = basalt.createFrame("mainFrame"):show()-- lets create a frame, a button without functionality and a thread
@@ -37,12 +37,12 @@ local function yourCustomHandler()
end end
end end
thread:start(yourCustomHandler) -- this will create a coroutine and starts the coroutine, os.sleep does the rest, so you just have to call start once. thread:start(yourCustomHandler) -- this will create a coroutine and starts the coroutine, os.sleep does the rest, so you just have to call start once.
```` ```
## Method 3: ## Method 3:
Using timers Using timers
````lua ```lua
local basalt = dofile("basalt.lua") local basalt = dofile("basalt.lua")
local mainFrame = basalt.createFrame("mainFrame"):show()-- lets create a frame, a button without functionality and a timer local mainFrame = basalt.createFrame("mainFrame"):show()-- lets create a frame, a button without functionality and a timer
@@ -53,4 +53,4 @@ local function yourCustomHandler()
-- add your logic here -- add your logic here
end end
timer:onCall(yourCustomHandler):setTime(1, -1):start() -- this will call your function every second until you :cancel() the timer timer:onCall(yourCustomHandler):setTime(1, -1):start() -- this will call your function every second until you :cancel() the timer
```` ```