WoWInterface (
-   Lua/XML Help (
-   -   How to trigger functions in game (

Lyeeroy 08-02-20 06:39 AM

How to trigger functions in game
Hi, have simple question..

Have a code with functions like this:

Lua Code:
  1. local version = 0.8
  3. print("func " .. version .. " loaded")
  5. function func_OnEvent(self, event)
  6.     --some code
  7. end
  9. function MsgTop(string)
  10.     --some code
  11. end
  13. function MsgChat(string)
  14.     --some code
  15. end

How do I call _OnEvent in game? I cant get it. Is this via XML? Or should I just call it on top of the code by:
Lua Code:
  1. func_OnEvent()
It seems weird.

Rilgamon 08-02-20 06:45 AM

xml is not a programming language. It just describes your frames.
You dont need xml for an addon.

Addons register for events that should trigger functions. Or you can trigger a timed event.
Take a look at SetScript and

Edit: Keep in mind that functions should be local, too.

Lyeeroy 08-02-20 06:50 AM

I saw XML file with:


                        <OnLoad> _OnLoad(); </OnLoad>
                        <OnEvent> _OnEvent(); </OnEvent>
                        <OnUpdate> _OnUpdate(); </OnUpdate>

So I thought with these you gotta call them.

That makes more sense now. Thank you

All times are GMT -6. The time now is 05:21 AM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI