Does exactly what it says on the box.
Adds a /lua command which allows you to execute Lua code on the fly from the chat box.
This lets you do things like use Lua for quick calculations or access parts of the Addon API.
For example;
/lua return 16 * 2048
/lua Print(Apollo.GetString("ChatLog_MultiJournal"))
/lua s = {"This", " is ", "neat!"}; return unpack(s)
- Output gets sent to the Debug channel.
- Compile and Runtime errors are all caught and appropriate error messages are output to debug. No addon errors should occur.
- Supports multiple return values.
- Return values are converted using tostring to attempt to output useful information.
- Stack tracing can be toggled using /lua trace (or /luatrace). Disabled by default.
This is offered as an alternative to the /eval command, not a replacement. Output should be cleaner, displayed along with the input that generated it, and faster to output values to the chat window. Stack trace info is only displayed if it is toggled on.
If you are a looking for a more feature-rich package, take a look at GeminiConsole over on the Wildstar forums or from wildstarnasa's git repository. It ties in with the rest of the Gemini package and offers integration with their GeminiLogging addon, along with features like multi-line input, partial chunk evaluation and expression inspection.
Feel free to use this however you like. If for whatever reason you use any portion of this code in your own project, credit in a comment of your source would be nice, but I won't hold you to it. :)