getscriptfromthread

Reads a thread's associated script.

Syntax

Signature
getscriptfromthread(Thread: thread) -> any

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
ThreadthreadLua thread whose global environment should be read.

Returns

TypeDescription
anyEnvironment script value, or nil.

Notes

Reads the raw script field from Thread's global environment. It does not inspect the thread's stack frames.

Example

Luau
local Result = getscriptfromthread(coroutine.running())
print(Result)