getcallingscript

Finds the script associated with the current call.

Syntax

Signature
getcallingscript() -> any

Aliases

This function has no aliases.

Parameters

This function takes no parameters.

Returns

TypeDescription
anyFirst non-nil environment script value, normally a script wrapper.

Notes

Walks the current Lua call stack and returns the first non-nil raw script field found in a Luau closure's environment. Returns nil when no frame supplies one.

Example

Luau
local Result = getcallingscript()
print(Result)