View Single Post
02-23-09, 06:56 AM   #1
ZikO
An Aku'mai Servant
Join Date: Jun 2008
Posts: 36
AddOn purely coded in lua.

Hi guys

I probably have very uncommon request to you and if you think you would have to put too much effort to help me just skip this threat.

I hate all this stuff with XML but unfortunately I need to know this as I can't get through running AddOn coded only in lua.

Can somebody please write very very simple AddOn (like showing frame with one button) in lua not involving XML at all. How to do that? Please.



So far. I have created xml file to handle OnEvent and OnLoad properties so my xml code looks like:

Code:
<ui> ...
    <OnLoad>MyAddon:Load()</OnLoad>
    <Onevent>MyAddon:EventHandler(frame, firstArg, ...)</OnEvent>
</ui>
Now, in lua i have to create functions whichmight look like:

Code:
function MyAddon:Load()
-- something to do when AddOn is loaded
end

function MyAddon:EventHandler(frame, firstArg, ...)
-- handle particular events
end
I tried to remove xml file and make frames in lua like below:
Code:
frame = CreateFrame("FRAME", "MyAddon")

frame:SetScript("OnLoad", MyAddon:Load)
frame:SetScript("OnEvent", myAddon:Eventhandler)
and it's not working. I'm still doing something wrong. Please if someone has enough time and write these a few lines on lua to show me that. The rest i should handle and manage to do. Many thanks.
  Reply With Quote