Fading Coder

An Old Coder’s Final Dance

Understanding Global Variables and Function Environments in Lua 5.1

In Lua 5.1, values of type thread, function, and userdata may each be linked to an environment table. That table is an ordinary Lua table used to hold names that the object resolves as "globals." Thread (coroutine) environments are only reachable from C. Userdata environments exist mainly...