I'll be frank. Use namespaces.
You have a bunch of stuff you want "global" put it into a class i.e. namespace.
Does LUA allow you to reference items within your namespace(s) without full qualifiers? No.
But then you are not making namespaces like Viacom.Nickelodeon.West.Post
Just be smart. You use LibAddonMenu right? Most people probablly declare it as LAM
LAM: is your namespace/entry point.
Do the same thing to wrap "globals", dont go making a
defaults = {}
in the main module space when everyone and their uncle will do the same and cause a conflict.
MyModule.defaults = {}
I prefer dot notation, though I can see the argument for simply prepends of some prefix like MM_
Either case, yes, you SHOULD mangle/prefix/tag your stuff different from everyone elses.
|