util.thread.current
Shared
Retrieves the currently running thread instance
Syntax
local result = util.thread.current()Parameters
| No parameters are accepted by this function |
|---|
Returns
| Type | Name | Description |
|---|---|---|
thread | bool | result | Currently running thread instance, false if no thread is active |
Examples
local entity = util.thread.create(function(self)
core.engine.print("info", "Running thread:", util.thread.current())
end)
entity:resume()local running = util.thread.current()
if not running then
core.engine.print("info", "Not inside a thread")
end