Cr4x good eye thanks
So I looked over the gatherer addonon but that didn't help much with the slash command issue. The problem was still with my functions, and the variables being passes between them. After digging around for a few hours online and looking at different tutorials I realised I was assuming there was something different about lua that I didn't know, but its not actually different in any way, all the source code I was looking at was confusing me due to the different styles of coding people have. Xrystal yours was what pointed me towards that fact since it was similar to how I read/write code. more so than others. After I get a grasp of a language I'm usually fine reading it no matter who created it, but starting out it can be difficult.
So here is what I have working for me right now. It handles the slash command and the triggering of functions in the functions.lua script I started just fine. functions just output text to the chat as they are executed for now but the text will be replaced with some actual api content soon to learn/test more on
main.lua
Lua Code:
name = "mmoui"
nameupper = "MMOUI"
command = "/mmo"
version = 0.01
saveddata = "mmoui_SavedData"
default = {}
data = {}
function slashcommand( )
d("You are using " .. nameupper .. " version " .. version)
d("Configuration settings are in the game settings interface!")
end
function initilize(eventid,addon)
SLASH_COMMANDS[command] = slashcommand
if addon ~= name then return end
EVENT_MANAGER:UnregisterForEvent(name,eventid)
EVENT_MANAGER:RegisterForEvent( name , EVENT_PLAYER_ACTIVATED , activated )
end
function activated()
d("Loaded " .. nameupper .. " version " .. version)
mmouibag()
-- do stuff
end
-- trigger AddOnLoaded function, passes this eventID to function
EVENT_MANAGER:RegisterForEvent( name , EVENT_ADD_ON_LOADED , initilize )
functions.lua
Lua Code:
function mmouibag()
d("Loaded BAG")
end
Thank you both for all the assistance