That was a big help I do not have any errors showing up any more, and I think I have a bit of a grasp on the functions now... maybe... let me know if any of my commenting or anything looks off.
However, I cant get the slash command to work. haven't gotten past that point yet.
having "SLASH_COMMANDS[addonCommand] = addon_slash" in the init function doesn't work anymore, and it wont work if moved to any of the other functions....
Sorry to be such a noob on all this, and thanks again for the help.
Lua Code:
local addonName = "MMOUI"
local addonCommand = "/mmo"
local addonVersion = 0.01
local addonData = {}
-- Default Saved settings
addonData.defaults = {
-- Bag
overideBag = true
}
-- Initialize addon data
local function init_addondata()
-- Slash command handler
SLASH_COMMANDS[addonCommand] = addon_slash
-- Load saved variables
mmoVars = ZO_SavedVars:New( 'MMOUI_VARS' , math.floor( addonVersion * 100 ) , nil , addonData.defaults )
end
-- Addon is active and can call runtime functions
local function addon_activated( eventid )
-- do stuff
--if (mmoVars.overideBag == true) then
--mmo_bag()
--end
end
-- Load addon
local function addon_loaded(eventid, addon)
-- if addon is for this script trigger init_addondata
if addon == addon_name then init_addondata()
-- trigger player activated passes this eventid to addon_activated function
EVENT_MANAGER:RegisterForEvent(addonName,EVENT_PLAYER_ACTIVATED,addon_activated)
end
end
local function addon_slash( text )
d( "You are using ".. addonName .. " version " .. addonVersion )
d( addonName .. " configuration settings are in the game settings interface!" )
end
-- trigger addon_loaded function, passes this eventid to function
EVENT_MANAGER:RegisterForEvent(addonName,EVENT_ADD_ON_LOADED,addon_loaded)