![]() |
The API is no longer being updated here until further notice. |
<Script> (child of <Ui>) executes Lua code.
<Script file="" /> <Script> -- Lua code </Script>
Attributes[]
- file (xs:string? ) - Relative path to a
*.lua
file, in lieu of coding Lua inside the XML file.
Details[]
- Executed when reached by the XML parser, going from top to bottom.
- Similar to <Include> when referring to another file.
- Similar to <Scripts> except placed in <Ui> rather than a <Frame>.
Example[]
The following code creates the frame first, then runs a script that refers to it:
<Frame name="foo">
<Scripts>
<OnLoad>
self.bar = "test"
</OnLoad>
</Scripts>
</Frame>
<Script>
print(foo.bar)
</Script>
The following code runs the script first, causing an error:
<Script>
print(foo.bar) -- error
</Script>
<Frame name="foo">
<Scripts>
<OnLoad>
self.bar = "test"
</OnLoad>
</Scripts>
</Frame>