lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 6/22/22 11:07, Ryan Starrett wrote:
Of course, you could also vouch for no naming changes and explicitly use _G to look up the global. Some may call this ugly, but it's about as explicit as you'll get haha.


I wonder if there's an argument, on larger projects, for something like:

====

--global.lua

return {}

====

--myappfiles*.lua

local global = require"global"

-- Init
global.foo = 123

-- etc...

====

Leaving _G to the standard libs.

Scott