getsenv
Only works on active scripts
This function will throw an error if the script isn't currently running. If the script is running but on a different Lua State (such as on an Actor), the function will return nil instead.
getsenv
returns the global environment table of a given Script
, LocalScript
, or ModuleScript
.
This environment contains all global variables, functions available to the target script, such as custom-defined functions or state values.
Parameters
Parameter | Description |
---|---|
script |
The script instance whose environment should be retrieved. |