49
edits
| Line 51: | Line 51: | ||
script 'bob' | script 'bob' | ||
> fred | > fred | ||
</kua> | |||
=== Inline multi-runtime scripting === | |||
Run Lua and JS from script: | |||
<kua> | |||
var bob fred | |||
lua print(1 + 2) | |||
js print(1 + 3) | |||
context lua | |||
print(1 + 4) | |||
script 'bob james;bob' | |||
exit | |||
context lua | |||
print(1 + 5) | |||
script 'bob alan;bob' | |||
exit | |||
> 3 | |||
> 4 | |||
> fred | |||
> 5 | |||
> james | |||
> 6 | |||
> alan | |||
</kua> | </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. | ||