Engine:CCMD lua.lua edit: Difference between revisions

no edit summary
No edit summary
Line 1: Line 1:
{{dev/uiccmd}}
{{dev/uiccmd}}
Runs a Lua statement in a Lua runtime.
Runs a Lua statement in a Lua runtime.
<kua>print("fred")</kua>
<kua>lua print("fred")</kua>


== Arguments ==
== Arguments ==
* name - (none)
* name - (none)
* value - the verbatim text of the Lua statement or statements to be run
* value - the verbatim Lua to be run


== Associations ==
== Associations ==
Line 13: Line 13:


== Details ==
== Details ==
Can be used to run commands as though were directly in a Lua console, if the first statement is not engine command, variable or alias in the 'lua' context.
Used to run a Lua text directly in the 'lua' context, if the first statement is not engine command, variable or alias in the 'lua' context. This allows the script in the 'lua' context to act as though it were running directly in a Lua console.


While the 'lua' context has the ability to hold variables and aliases, they cannot be created from script as the 'lua' context has no 'alias', 'set' or 'var' type script commands added to the context.
While the 'lua' context has the ability to hold variables and aliases, they cannot be created from script as the 'lua' context has no 'alias', 'set' or 'var' type script commands added to the context.
If the outer scope of the Lua code calls return, the return values will be printed. For example:
<kua>a = 1; return 1</kua> Will write '1' to the engine log/console.


== Examples ==
== Examples ==