From 6a70a17a66c5d920c1780798d3550e745dd05ef8 Mon Sep 17 00:00:00 2001
From: Robert Jelic <36573031+NoryiE@users.noreply.github.com>
Date: Tue, 3 May 2022 18:06:33 +0200
Subject: [PATCH] Updated Thread (markdown)
---
Thread.md | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/Thread.md b/Thread.md
index 6d3f665..01a7632 100644
--- a/Thread.md
+++ b/Thread.md
@@ -1 +1,39 @@
-WIP
\ No newline at end of file
+Threads are "functions" you can execute simultaneously. Ofc the reality is, i am just using coroutine for that. But it works pretty good AND is very easy to use.
+
+Here is a list of all available functions for threads:
+
+## start
+sets the time the timer should wait after calling your function
+````lua
+local mainFrame = basalt.createFrame("myFirstFrame"):show()
+local aThread = mainFrame:addThread("myFirstThread"):show()
+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)
+````
+**parameters:**function func
+**returns:** self
+
+## getStatus
+gets the thread status
+````lua
+local mainFrame = basalt.createFrame("myFirstFrame"):show()
+local aThread = mainFrame:addThread("myFirstThread"):show()
+basalt.debug(aThread:getStatus()) -- returns "running", "normal", "suspended" or "dead"
+````
+**parameters:** -
+**returns:** string "running" - if its running, "normal" - is active but not running (waiting for a event), "suspended" - is suspended
+
+## stop
+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"
+````
+**parameters:** -
+**returns:** self
\ No newline at end of file