49
edits
(→Key) |
(→Key) |
||
| Line 15: | Line 15: | ||
** <kua>bob james; bob</kua> Prints 'james'. In the first statement, the global default command 'varedit' finds the existing 'bob' variable in the 'global' context, and assigns 'james'. In the next statement, the default command finds and prints the value of variable 'bob'. | ** <kua>bob james; bob</kua> Prints 'james'. In the first statement, the global default command 'varedit' finds the existing 'bob' variable in the 'global' context, and assigns 'james'. In the next statement, the default command finds and prints the value of variable 'bob'. | ||
** <kua>lua print(1 + 3)</kua> Prints '3'. The 'lua' context is addressable from 'global'. The default command 'lua_edit' in the 'lua' context runs the lua statement in the Lua runtime, where the 'print' is a real Lua statement, not an Engine script one. | ** <kua>lua print(1 + 3)</kua> Prints '3'. The 'lua' context is addressable from 'global'. The default command 'lua_edit' in the 'lua' context runs the lua statement in the Lua runtime, where the 'print' is a real Lua statement, not an Engine script one. | ||
** <kua>context lua; print(1 + 3); exit</kua> Also prints '3' and returns to 'global'. | ** <kua>context lua; print(1 + 3); exit</kua> Also prints '3' and returns to 'global'. The 'lua' context is switched to first, then the now unqualified Lua command is run in the Lua runtime using the same default 'lua_edit' command. 'exit' is a 'lua' context console command, so it runs instead of executing as Lua, and returns to 'global'. | ||
* Context - A script or command context. Each context may have its own commands and variables and rules. Examples: | * Context - A script or command context. Each context may have its own commands and variables and rules. Examples: | ||
** <kua>client start</kua> Starts the client service. The 'client' context is addressable from 'global', and the client 'start' command is run. | ** <kua>client start</kua> Starts the client service. The 'client' context is addressable from 'global', and the client 'start' command is run. | ||