Engine:CLUA script: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 21: Line 21:
<lua>
<lua>
function fred(s) script 'bob ' + s + ';bob' end
function fred(s) script 'bob ' + s + ';bob' end
script "lua fred('james')"
script "lua fred 'james'"
</lua>
</lua>
: Prints 'james'
: Prints 'james'

Latest revision as of 23:07, 18 October 2023

Console commands

Runs an engine script from the Lua runtime.

script "var bob fred"

Arguments[edit]

  • script - the block of text to be run as a script in the engine.

Associations[edit]

  • Is by default placed in the default Lua runtime.

Details[edit]

A global Lua runtime function that runs a script from Lua.

Examples[edit]

Default values[edit]

From Lua creates an engine variable 'bob' and prints its value:

script 'var bob fred;bob'

Creates a Lua function that sets and prints an engine variable and runs it from script, all from inside Lua.

function fred(s) script 'bob ' + s + ';bob' end
script "lua fred 'james'"
Prints 'james'

Notes[edit]