From d2df7a6e28a14f944e03cb6eaa90073b6834801a Mon Sep 17 00:00:00 2001
From: Robert Jelic <36573031+NoryiE@users.noreply.github.com>
Date: Tue, 3 May 2022 20:32:54 +0200
Subject: [PATCH] Updated Thread (markdown)
---
Thread.md | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/Thread.md b/Thread.md
index 01a7632..8d6ee2c 100644
--- a/Thread.md
+++ b/Thread.md
@@ -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:** -
**returns:** self
\ No newline at end of file