Lua console

  • Once a server is running (or perhaps in single game, on localhost), it would be nice to be able to send some Lua commands via simple socket connection and get the execution result. The commands would execute in the currently running server Lua context. This would greatly help debugging. Naturally, this socket would listen for incoming connections on the LAN interface only! Such implementation could be done using a Telnet interface (using PuTTy for client in Windows); the telnet interface would litterally work as a direct console to the server's Lua container; to be able to manipulate data while the server is running.


    This interface would, of course, only be enabled through the server.properties file, using a configuration keys such as lua_console_enabled=true, lua_console_port=23, etc.

  • No, just invoking Lua statements. For example, in World Edit, there's a function called getBlockId; being able to invoke that function directly from the console would return the value, thus help debugging and test. Or, in some script, if there's a global variable that should be set to a specific value, instead of trying to recreate the condition for that variable to be set properly, just invoke the console and set the variable manually. As simple as that.


    Or, for example, I'd like to evaluate the content of a player's attribute, live, while the server is running. I could simple test it in-line from the console. From a terminal, the Lua console can already be invoked, but there's a difference between that console and the game's. For instance, from a native Lua console, there's no include(), there's no getDatabase(), there's no getServer(), etc.


    Some typical use could look like this :


    Code
    $ telnet -l "AreaProtection 1.7" 127.0.0.1 23
    Rising World Lua Console Started
    Binding to "AreaProtection 1.7"
    > return server:findPlayerByName("LordFoobar");
    nil
    > = #areas
    47
    > ^C
    Connection terminated
    $


    Using the login name as the script to bind to (same name as in the definition.xml file). Using CTRL+C to quit.

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!