Modify luaconsole to use slash-command syntax

This commit is contained in:
2021-11-04 14:58:38 -04:00
parent 7966707450
commit bc01bd8513
2 changed files with 17 additions and 24 deletions

View File

@@ -10,19 +10,21 @@
// 3. Add the line to the LuaConsole using 'add'.
// 4. Get the command words using 'get_command'.
// 5. If the command is empty, do nothing.
// 6. If the command is nonempty, execute it and call 'clear'.
// 6. If the command is nonempty, execute it.
//
// The 'words' returned by the luaconsole can be empty, meaning
// that there's no command to execute. If the words are nonempty,
// then the first word is the command. There are two hardwired
// commands:
// The LuaConsole expects you to type one of three things:
//
// lua <expr> - execute a lua expression
// syntax <message> - print a syntax error message
// * Valid Lua Code.
// * Valid Lua Code preceded by '=' as shorthand for 'return'
// * A slash-command.
//
// If the first word is anything else, it means the user typed
// that word on the command line. It is up to you to interpret
// such commands.
// The 'get_command' returned by the luaconsole can be one of
// the following:
//
// empty vector - still collecting input: do nothing.
// lua <expr> - found a lua command: execute it as lua.
// syntax <words> - detected a syntax error: print the error.
// word word ... - read a slash-command: execute the command.
//
//////////////////////////////////////////////////////