Skip to content

Commit 119a800

Browse files
authored
getsenv thing
Improve getsenv
2 parents 199b913 + 5e4a4ba commit 119a800

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/Scripts/getsenv.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
!!! warning "Only works on active scripts"
44

5-
This function will throw an error if the script is not actively running or if it's running on a different Luau VM - such as an [Actor](https://create.roblox.com/docs/reference/engine/classes/Actor).
5+
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](https://create.roblox.com/docs/reference/engine/classes/Actor)), the function will return nil instead.
66

77
`#!luau getsenv` returns the **global environment table** of a given [`#!luau Script`](https://create.roblox.com/docs/reference/engine/classes/Script), [`#!luau LocalScript`](https://create.roblox.com/docs/reference/engine/classes/LocalScript), or [`#!luau ModuleScript`](https://create.roblox.com/docs/reference/engine/classes/ModuleScript).
88

99
This environment contains **all global variables, functions** available to the target script, such as custom-defined functions or state values.
1010

1111
```luau
12-
function getsenv(script: BaseScript | ModuleScript): { [any]: any }
12+
function getsenv(script: BaseScript | ModuleScript): { [any]: any } | nil
1313
```
1414

1515
## Parameters

0 commit comments

Comments
 (0)