Skip to main content

THREAD

Module: _thread

Detailed docs: Scripting > Threads​

Now()return(GameTime: number,FrameCount: number)
-- Returns seconds since the engine started, and the frame counter.
-- Both nil before the first frame.
_thread.Now() -> GameTime: number, FrameCount: number
2
Wait(Milliseconds: number)return(nil)
-- 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
3
Delete(Handle: threadHandle)return(nil)
-- Stops the worker
_thread.Delete(Handle: threadHandle) -> nil
4
Loop(Ms: number,Fn: function,...optional variadic any?)return(Handle: threadHandle)
_thread.Loop(Ms: number, Fn: function, ...any?) -> Handle: threadHandle
5
Create(Fn: function,...optional variadic any?)return(Handle: threadHandle)
-- 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
6