ThreadMethods
self:sleep
Shared
Puts an existing thread on sleep
Syntax
local status = self:sleep(duration)Parameters
| Type | Name | Description |
|---|---|---|
int | duration | Sleep duration in milliseconds |
Returns
| Type | Name | Description |
|---|---|---|
bool | status | Returns true on successful execution, or false on failure |
Examples
local self = thread:create(function(self)
engine.print("Thread sleeping for 5 seconds")
self:sleep(5000)
engine.print("Thread awaken now")
end)
self:resume()