For those not familiar, the first variable is the string name of the AddOn, and the second is a private table that is unique to that AddOn. The string is not passed to each Lua file within that AddOn, but the table is passed. This is commonly used to create localization tables in one file, and be able to use it in another. Here's another example.
-- file one
local name, addon = ...
print(name)
-- prints the same value as ## Title from the ToC.
function addon:SomeFunction()
-- does some stuff
end
-- file two
local _, addon = ...
addon:SomeFunction() -- defined in file one, but called from file two
The folderName is the actual name of the folder your AddOn resides in. Despite what Myrroddin said, it is passed in every file - that entire line is valid for every file in your project.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
The second argument passed to each lua file - is this in the global namespace for ALL addons, or unique to each addon?
local ADDON_NAME, T = ...
Will doing something like the following pollute the global namespace and cause collisions with other addons?
T["SomeCommonlyUsedName"] = "something"
it's unique to each addon. Use it for whatever you'd like.
Thank you very much for the quick reply! Have a good one.
For those not familiar, the first variable is the string name of the AddOn, and the second is a private table that is unique to that AddOn. The string is not passed to each Lua file within that AddOn, but the table is passed. This is commonly used to create localization tables in one file, and be able to use it in another. Here's another example.
More accurately:
The folderName is the actual name of the folder your AddOn resides in. Despite what Myrroddin said, it is passed in every file - that entire line is valid for every file in your project.