WoW:AddOn loading process: Difference between revisions

m
Line 25: Line 25:
To illustrate the loading order, consider the following addon code example:
To illustrate the loading order, consider the following addon code example:


<span style="font-size: 1.6em">LoadingOrder.toc</span>
 
'''LoadingOrder.toc'''
  ##Interface: 30000
  ##Interface: 30000
  ##Title: Loading Order Demo
  ##Title: Loading Order Demo
Line 31: Line 32:
  file2.xml
  file2.xml
  file3.lua
  file3.lua
<span style="font-size: 1.6em">file1.lua</span>
 
 
'''file1.lua'''
  print("This loads first")
  print("This loads first")
<span style="font-size: 1.6em">file2.xml</span>
 
 
'''file2.xml'''
  <Ui>
  <Ui>
   <Frame name="TemplateFrame" virtual="true">
   <Frame name="TemplateFrame" virtual="true">
     <Frames>
     <Frames>
Line 46: Line 52:
     </Frames>
     </Frames>
   </Frame>
   </Frame>
   <Frame inherits="TemplateFrame">
   <Frame inherits="TemplateFrame">
     <Frames>
     <Frames>
     <Frame>
     <Frame>
       <Scripts>
       <Scripts>
Line 55: Line 63:
       </Scripts>
       </Scripts>
     </Frame>
     </Frame>
     <Frame>
     <Frame>
       <Scripts>
       <Scripts>
Line 62: Line 71:
       </Scripts>
       </Scripts>
     </Frame>
     </Frame>
      <Scripts>
      <OnLoad>
    </Frames>
        print("Parent frame's OnLoad fires after its children's.")
      </OnLoad>
    <Scripts>
      </Scripts>
    <OnLoad>
    </Frame>
      print("Parent frame's OnLoad fires after its children's.")
  </Frames>
    </OnLoad>
    </Scripts>
  </Frame>
   <Script file="file2.5.lua"/>
   <Script file="file2.5.lua"/>
  </Ui>
  </Ui>
<span style="font-size: 1.6em">file2.5.lua</span>
 
 
'''file2.5.lua'''
  print("Files included in XML are executed as they are encountered");
  print("Files included in XML are executed as they are encountered");
<span style="font-size: 1.6em">file3.lua</span>
 
 
'''file3.lua'''
  print("This concludes this presentation");
  print("This concludes this presentation");