Allow lua files to explicitly modify the global environment (_G)
Access the global environment explicitly when necessary

This is necessary because "lua_function =" can only take
names of functions that are directly in the global environment.

This is the last error in 1.11 except for animation image issues.
Fixed trivial mistake