[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: First addon help
- From: Svein Arne Nilsen <sanilse@...>
- Date: Wed, 19 Jan 2011 17:59:09 +0100
Hi
Im new to lua and wondering if i can get some help.
This is a sampel addon iv pickt up.
local HelloWorld = {} -- the AddOn namespace, all your functions should be
placed inside here instead of as globals.
_G.HelloWorld = HelloWorld -- expose it to the global scope
local frame = _G.HelloWorld_Frame -- made in the XML
--- Print out "Hello, World!" to the chat frame
-- @usage HelloWorld.Print()
function HelloWorld.Print()
DEFAULT_CHAT_FRAME:AddMessage("Hello, World!")
end
frame:RegisterEvent("VARIABLES_LOADED") <-- it stopps
here saying its a nil value
function HelloWorld:OnEvent(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7,
arg8, arg9)
-- this is a fun trick that will call a method named the event, passing
in all the relevant args.
self[event](self, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
end
function HelloWorld:VARIABLES_LOADED()
self.Print()
end
any help plz