Scripts

getscriptthread

Returns the thread associated with a script when one is available.

Syntax

getscriptthread(script: userdata): thread | nil

Arguments

NameTypeDescription
scriptuserdataScript or ModuleScript instance to inspect.

Returns

NameTypeDescription
threadthread | nilThread associated with the script, or nil.

Description

Returns the thread associated with a script when one is available.

Call it with 1 parameter(s): script. The argument table explains which values are required and which ones only refine the behavior.

It returns thread (thread | nil). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Example call with placeholder values.

local result = getscriptthread(game)
print(result)