_G is a global variable that simply refers to the global environment (it can be set by the user to something else but it does not change any behavior).
_ENV is used when binding/referencing free names. The user can change _ENV and it will affect where global variables are stored and how names are looked up.
See: https://www.lua.org/manual/5.3/manual.html#2.2
_Gis a global variable that simply refers to the global environment (it can be set by the user to something else but it does not change any behavior)._ENVis used when binding/referencing free names. The user can change_ENVand it will affect where global variables are stored and how names are looked up.See: https://www.lua.org/manual/5.3/manual.html#2.2