getthreadenvironment
Returns the environment a thread resolves global names through.
Answers with the environment of the innermost Lua function on the thread rather than the thread's globals table, because a chunk running under a custom environment hands that environment to the threads it spawns. A thread with no Lua frame falls back to its globals table.
getthreadenvironment(thread: thread): tableParameters
| Parameter | Type | Description |
|---|---|---|
thread | thread | Thread to inspect. |
Example
print(getthreadenvironment(coroutine.running()) == getfenv(1))Example output
trueErrors: A thread with no readable environment raises an error.
