Navigation menu

Engine:CCMD lua.lua edit: Difference between revisions

Jump to navigation Jump to search
Line 26: Line 26:
</kua>
</kua>
: Prints '3'.
: Prints '3'.
=== Dual inline scripting ===
Run Lua from script:
<kua>
lua print(1 + 2)
> 3
</kua>
Run script from lua:
<kua>
var bob fred
context lua
script 'bob'
> fred
exit
</kua>
Together fluidly:
<kua>
var bob fred
lua print(1 + 2)
> 3
bob
> fred
context lua
print(1 + 2)
> 3
script 'bob'
fred
</kua>


== Notes ==
== Notes ==
* While 'lua_edit' is intended make console Lua commands easy to run, can allow scripts and other types of macros to avoid lots of situations where complex logic would otherwise be required, by simply switching to the 'lua' context and then running a series of single line lua chunks.
* While 'lua_edit' is intended make console Lua commands easy to run, can allow scripts and other types of macros to avoid lots of situations where complex logic would otherwise be required, by simply switching to the 'lua' context and then running a series of single line lua chunks.