User Tools

Site Tools


lua:scripting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
lua:scripting [2022/11/12 15:58] – [Lua in WoW] utedasslua:scripting [2022/11/12 22:12] (current) – [Examples] utedass
Line 12: Line 12:
 ====== Lua in WoW ====== ====== Lua in WoW ======
  
 +  * ''/reload'' -- Reload plugin directories
   * ''/console scriptErrors 1'' -- Enable lua errors   * ''/console scriptErrors 1'' -- Enable lua errors
   * ''/console scriptErrors 0'' -- Disable lua errors   * ''/console scriptErrors 0'' -- Disable lua errors
-  * ''/etrace'' -- Open +  * ''/etrace'' -- Open event trace 
 +  * ''/fstack'' -- Toggle Frame Stack debugging
   * [[https://wowwiki-archive.fandom.com/wiki/Events_A-Z_(full_list)|WoW events]]   * [[https://wowwiki-archive.fandom.com/wiki/Events_A-Z_(full_list)|WoW events]]
   * [[https://wowpedia.fandom.com/wiki/TOC_format|.toc format]]   * [[https://wowpedia.fandom.com/wiki/TOC_format|.toc format]]
 +  * [[https://wowpedia.fandom.com/wiki/Frame_Strata|Frame Strata]]
 +  * [[https://wowwiki-archive.fandom.com/wiki/AddOn_loading_process|AddOn loading process]]
 ====== Cheat sheet ====== ====== Cheat sheet ======
  
Line 118: Line 122:
 </code> </code>
  
 +===== Examples =====
 +
 +<code lua>
 +-- Create a frame and register this frame to run code on an event.
 +local function PrintStuff()
 + print("Now this code is executed!")
 +end
 +
 +local EventFrame = CreateFrame("frame", "EventFrame")
 +EventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
 +
 +EventFrame:SetScript("OnEvent", function(self, event, ...)
 + if(event == "PLAYER_ENTERING_WORLD") then
 + C_Timer.After(1, PrintStuff)
 + end
 +end)
 +</code>
lua/scripting.1668268698.txt.gz · Last modified: 2022/11/12 15:58 by utedass

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki