View Single Post
05/01/14, 08:02 AM   #1
Feroc
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 5
Already failing at Event_Add_on_Loaded

Hi there,

I am playing around a bit with LUA, but for me it looks like I set up something wrong.

I've tried it with the easiest examples of all:

TestOne.txt:

Code:
## Title: TestOne
## APIVersion: 100003

TestOne.lua
Test One lua:

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:
user:/AddOns/TestOne/TestOne.lua:1: attempt to index a nil value
stack traceback:
user:/AddOns/TestOne/TestOne.lua:1: in function '(main chunk)'
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?
  Reply With Quote