Thread: Addon Etiquette
View Single Post
04/21/14, 12:13 PM   #25
Joviex
 
Joviex's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 42
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.
  Reply With Quote