I was able to make some progress on this just with trial and error.
Basically I Changed the function names to MMO_xxx() Insread of MMO.xxx(),
added local infront of each function,
and Removed the RegisterForEvent and added a simple function call to initialize at the end.
Lua Code:
-- Default Saved Variables
MMO.defaults = {
-- Bag
OverideBag = true,
-- Map
OverideMap = true,
-- ActionBar
OverideActionBar = true,
-- Mouse
OverideMouse = true
}
local function MMO_Initialize()
-- Register the slash command handler
SLASH_COMMANDS[MMO.command] = MMO_Slash
-- Load saved variables
MMO.Vars = ZO_SavedVars:New( 'MMO_VARS' , math.floor( MMO.version * 100 ) , nil , MMO.defaults )
if (MMO.Vars.OverideBag == true) then
MMO_bag()
end
--if (MMO_Vars.OverideActionBar == true) then
--MMO_actionbar()
--end
end
local function MMO_Update()
end
local function MMO_Slash( text )
MMO_Message()
end
local function MMO_Message()
d( "You are using ".. MMO.name .. " version " .. MMO.version )
d( MMO.name .. " configuration settings are in the game settings interface!" )
end
MMO_Initialize()
This worked well while I had the call to the functions MMO_bag() commented out much like MMO_actionbar() is commented out.
MMO_bag() is in a separate file functions.lua at the moment whether it has any code in the function or not it throws this new error
user:/AddOns/mmoui/mmoui.lua:23: function expected instead of nil
stack traceback:
user:/AddOns/mmoui/mmoui.lua:23: in function 'MMO_Initialize'
user:/AddOns/mmoui/mmoui.lua:45: in function '(main chunk)'
|
and the code for function.lua
Lua Code:
local function MMO_bag()
--[[--
if BAG == nil then
local BAG = ZO_PlayerInventoryBackpack
BAG:SetCenterColor(0,0,0,0.5)
BAG:SetTexture(CT_BACKDROP)
BAG:SetEdgeColor(.1,.1,.1,1)
BAG:SetEdgeTexture("",8,1,2)
end
--]]--
end
Theirs something different about lua that I cant wrap my head around. basic to php and most languages give me little trouble. I am definitely missing something with how the functions work, or variable get passed around. lua examples I see online look very little like what is used in these addons....