View Single Post
04/26/24, 10:12 AM   #13
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,003
Another example for that will be e.g. SavedVariables where you use ZO_SavedVars wrapper to load the global SavedVariable table, which you have defined in your manifest txt file after ## SavedVariables: <tableNameHere>, into a local reference "settings".

Code:
local settings = ZO_SavedVars:New*
settings is a local reference then to the global table _G, where there was defined another subtable called <tableNameHere>

_G["<tableNameHere>"] = same as <tableNameHere>

If e.g. <tableNameHere> would be MyAddonsSavedVariables then you can access (after EVENT_ADD_ON_LOADED) that table MyAddonsSavedVariables directly or via _G["MyAddonsSavedVariables"], and your local settings would point to the actual real savedvariables patch like
MyAddonsSavedVariables["Default"]["NA Megaserver"]["@accountName"]
which all got handled by the wrapper ZO_SavedVars creating these subtables if not already exisiting and then returning that reference
  Reply With Quote