Originally Posted by step1step2
|
You changed the code and introduced a bug. :P No worries I'll walk you through it:
When you defined the #Initialize method you used the dot notation, so "self" doesn't exist in there.
Either you give that method the correct "self" object or you use the colon notation:
Code:
function Maneuver:Initialize(...)
Which works exactly like if you had done this:
Code:
function Maneuver.Initialize(self, ...)
But when you call this method you have to give it the "self" it is expecting so you either do this:
Code:
Maneuver:Initialize(...)
Or this:
Code:
Maneuver.Initialize(Maneuver, ...)
Because the way you did "self" in there is the eventCode thrown by EVENT_ADD_ON_LOADED, so the test "... == self.name" will never work.
Also no need for "GetEventManager()". That's exactly what was assigned to the global EVENT_MANAGER, so you can just use it.
A big pro tip that worked really great for me was to read A REALLY LOT of the source code for the stock UI, you can find it here:
http://esodata.uesp.net/current/src/luadir.html
Just explore the folders and files reading randomly or search for something you'd like to see, you'll learn TONS of stuff about the API and Lua (and the methodologies and background of the developers at ZOS
).
EDIT.
There, fixed it for you:
https://gist.github.com/haggen/d5672ea740eb4ae326a0