Engine:CLUA script: Difference between revisions
Jump to navigation
Jump to search
Line 20: | Line 20: | ||
Creates a Lua function that sets and prints a variable and runs it from script, all from inside Lua. | Creates a Lua function that sets and prints a variable and runs it from script, all from inside Lua. | ||
<lua> | <lua> | ||
function | function fred(s) script 'bob ' + s + ';bob' end | ||
script "lua | script "lua fred('james')" | ||
</lua> | </lua> | ||
: Prints ' | : Prints 'james' | ||
== Notes == | == Notes == | ||
* | * |
Revision as of 23:06, 18 October 2023
Runs an engine script from the Lua runtime.
script "var bob fred"
Arguments
- script - the block of text to be run as a script in the engine.
Associations
- Is by default placed in the default Lua runtime.
Details
A global Lua runtime function that runs a script from Lua.
Examples
Default values
From Lua creates an engine variable 'bob' and prints its value:
script 'var bob fred;bob'
Creates a Lua function that sets and prints a variable and runs it from script, all from inside Lua.
function fred(s) script 'bob ' + s + ';bob' end
script "lua fred('james')"
- Prints 'james'