Updated Thread (markdown)

Robert Jelic
2022-05-03 20:32:54 +02:00
parent 6da25bc407
commit d2df7a6e28

@@ -33,7 +33,15 @@ stops the thread
````lua
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aThread = mainFrame:addThread("myFirstThread"):show()
basalt.debug(aThread:getStatus()) -- returns "running", "normal", "suspended" or "dead"
local function randomThreadFunction()
while true do
basalt.debug("Thread is active")
os.sleep(1) -- a sleep/coroutine.yield() or pullEvent is required otherwise we will never come back to the main program (error)
end
end
aThread:start(randomThreadfunction)
local aButton = mainFrame:addButton("myFirstButton"):setText("Stop Thread"):onClick(function() aThread:stop() end):show()
````
**parameters:** -<br>
**returns:** self<br>