You should think about using local variables and function names, or put the functions and variables in a table that is only used in your addon.
Otherwise you could overwrite a variable/function of another addon that got the same name
If you use local functions the order of the functions and variables must be correct! lua is interpreting the function/variable names from top to bottom so you need to put functions that are local and will be called BEFORE (more to the top) the place where you call it.
Lua Code:
local function combatStatusChanges(eventCode, inCombat)
-- literally anything sould cause it to debug output
d("In combat: " .. tostring(inCombat))
end
local function Initialise()
EVENT_MANAGER:RegisterForEvent("TestAddon1", EVENT_PLAYER_COMBAT_STATE, combatStatusChanges)
end
local function addOnInit(event, addonName)
if addonName == "TestAddon1" then
Initialise()
end
end
EVENT_MANAGER:RegisterForEvent("TestAddon1", EVENT_ADD_ON_LOADED, addOnInit)
This code should bring you your message "help me" to the chat.
Be sure to check if the chat tabs you are using got the "system" messages activated in the tab options!
right click the tab and choose options, then have a look at the middle-right and mark the checkbox for system and say close.