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
lua:scripting [2022/11/12 16:21] – [Functions] utedasslua:scripting [2022/11/12 22:12] (current) – [Examples] utedass
Line 126: Line 126:
 <code lua> <code lua>
 -- Create a frame and register this frame to run code on an event. -- 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") local EventFrame = CreateFrame("frame", "EventFrame")
 EventFrame:RegisterEvent("PLAYER_ENTERING_WORLD") EventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
Line 131: Line 135:
 EventFrame:SetScript("OnEvent", function(self, event, ...) EventFrame:SetScript("OnEvent", function(self, event, ...)
  if(event == "PLAYER_ENTERING_WORLD") then  if(event == "PLAYER_ENTERING_WORLD") then
- ChatFrame1:Hide()+ C_Timer.After(1, PrintStuff)
  end  end
 end) end)
 </code> </code>
lua/scripting.1668270116.txt.gz · Last modified: 2022/11/12 16:21 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