Update Basalt.md

This commit is contained in:
Robert Jelic
2022-07-27 13:22:04 +02:00
committed by GitHub
parent 763d30a541
commit 83a27fbd09

View File

@@ -171,8 +171,8 @@ end)
<button onClick="clickMe" text="Click me" /> <button onClick="clickMe" text="Click me" />
``` ```
## basalt.shedule ## basalt.schedule
Shedules a function which gets called in a coroutine. After the coroutine is finished it will get destroyed immediatly. It's something like threads, but with some limits. Schedules a function which gets called in a coroutine. After the coroutine is finished it will get destroyed immediatly. It's something like threads, but with some limits.
#### Parameters: #### Parameters:
1. `function` a function which should get executed 1. `function` a function which should get executed
@@ -181,11 +181,11 @@ Shedules a function which gets called in a coroutine. After the coroutine is fin
1. `function` it returns the function which you have to execute in order to start the coroutine 1. `function` it returns the function which you have to execute in order to start the coroutine
#### Usage: #### Usage:
* Creates a shedule which switches the color between red and gray * Creates a schedule which switches the color between red and gray
```lua ```lua
local mainFrame = basalt.createFrame() local mainFrame = basalt.createFrame()
local aButton = mainFrame:addButton():setText("Click me") local aButton = mainFrame:addButton():setText("Click me")
aButton:onClick(basalt.shedule(function(self) aButton:onClick(basalt.schedule(function(self)
self:setBackground(colors.red) self:setBackground(colors.red)
os.sleep(0.1) os.sleep(0.1)
self:setBackground(colors.gray) self:setBackground(colors.gray)