Skip to main content

ThreadModule

Description:

  Allows you to work with threads.

newThread

Type: Function.

Description:

  Creates a new Thread from a filename, string or FileData object containing Lua code.

Signature:

newThread: function(code_or_filename: string | any): Thread

Parameters:

ParameterTypeDescription
code_or_filenamestring or anyThe name of the Lua file to use as the source. Depending on the overload: The FileData containing the Lua code to use as the source. Depending on the overload: A string containing the Lua code to use as the source. It needs to either be at least 1024 characters long, or contain at least one newline.

Returns:

Return TypeDescription
ThreadA new Thread that has yet to be started.

newChannel

Type: Function.

Description:

  Create a new unnamed thread channel. One use for them is to pass new unnamed channels to other threads via Channel:push on a named channel.

Signature:

newChannel: function(): Channel

Returns:

Return TypeDescription
ChannelThe new Channel object.

getChannel

Type: Function.

Description:

  Creates or retrieves a named thread channel.

Signature:

getChannel: function(name: string): Channel

Parameters:

ParameterTypeDescription
namestringThe name of the channel you want to create or retrieve.

Returns:

Return TypeDescription
ChannelThe Channel object associated with the name.