WoW:API RunScript: Difference between revisions

m
Move page script moved page API RunScript to WoW:API RunScript without leaving a redirect
m (Move page script moved page API RunScript to WoW:API RunScript without leaving a redirect)
 
(2 intermediate revisions by one other user not shown)
Line 6: Line 6:
== Parameters ==
== Parameters ==
=== Arguments ===
=== Arguments ===
:("script")
:;script : string - code to be executed


:;script : String - The code which is to be executed.
=== Returns ===
=== Returns ===
:''nil''
:none


== Example ==
== Example ==
:To define a function dynamically you could do:
:To define a function dynamically you could do:
<!-- begin code -->
<pre>
local retExpr = '"Hello " .. UnitName("target")';
local retExpr = '"Hello " .. UnitName("target")';
RunScript("function My_GetGreeting() return " .. retExpr .. ";end");
RunScript("function My_GetGreeting() return " .. retExpr .. ";end");
<!-- end code -->
</pre>
==== Result ====
 
=== Result ===
:The My_GetGreeting() function will be defined to return Hello followed by the name of your target.
:The My_GetGreeting() function will be defined to return Hello followed by the name of your target.


Anonymous user