Originally Posted by Feroc
...
Code:
function TestOne.Initialize(eventCode, addOnName)
if (addOnName ~= "TestOne") then
return
end
d("TestOne Loaded...")
end
EVENT_MANAGER:RegisterForEvent("TestOne", EVENT_ADD_ON_LOADED, TestOne.Initialize);
That already throws an error:
If I change TestOne.Initialize to TestOneInitialize I don't get the error anymore... but I don't get a "TestOne Loaded" in the chat either. It just does nothing.
What am I doing wrong?
|
You are trying to add something to table TestOne that does not exists. If you create that table first, it will work.
Lua Code:
TestOne = {}
function TestOne.Initialize(eventCode, addOnName)
if (addOnName ~= "TestOne") then
return
end
d("TestOne Loaded...")
end
EVENT_MANAGER:RegisterForEvent("TestOne", EVENT_ADD_ON_LOADED, TestOne.Initialize)