THREAD
Module: _thread
Detailed docs: Scripting > Threads
Now()
(GameTime:
,FrameCount:
)
2
(GameTime:
,FrameCount:
) -- Returns seconds since the engine started, and the frame counter.
-- Both nil before the first frame.
_thread.Now() -> GameTime: number, FrameCount: number
Wait(Milliseconds:
)
(
)
3
)
(
) -- Pauses the current worker until Milliseconds pass.
-- Up to 1 frame late; loops do not accumulate the lateness.
-- Wait(0) means next frame. Negative or non-number counts as 0.
_thread.Wait(Milliseconds: number) -> nil
Delete(Handle:
)
(
)
4
)
(
) -- Stops the worker
_thread.Delete(Handle: threadHandle) -> nil
Loop(Ms:
,Fn:
,...
?)
(Handle:
)
5
,Fn:
,...
?)
(Handle:
) _thread.Loop(Ms: number, Fn: function, ...any?) -> Handle: threadHandle
Create(Fn:
,...
?)
(Handle:
)
6
,...
?)
(Handle:
) -- Starts Callback immediately; it runs until its first Wait, return, or error.
-- Extra arguments are passed to Callback.
-- Returns a handle for Delete.
_thread.Create(Fn: (...any) -> (), ...any) -> Handle: threadHandle