What is this?
This is an addon that hooks into existing editboxes and adds Lua syntax highlighting and indentation to them. The screenshots should be all the clarification you need. This is useful for all you Lua developers that like to test Lua code ingame. For the rest of you... you probably won't need this.
This is both a standalone addon and an embedded library.
The standalone addon is simply the embedded part + a set of default hookings.
Description for users
Unzip the addon into your AddOns directory and it'll Just Work(tm).
Description for developers
It's easy to add embed this into your own addon and hook it into your own editboxes. This won't add any dependencies to your addon (Yay!). See inside indent.lua for more details.
Default hookings
This addon automatically hooks the following addons to get syntax highlighting:
* LuaPad
* TinyPad
* LuaSlinger
* Phoenix
* Inspector
* FuncBook
It's extremely easy to add more addons to this list. Just take a look inside defaulthooks.lua and add the addon to the table using the same format as the others. Let me know if you want me to add builtin support for some other editor.
Changelog
Revision 13 - Fixed bug that occured when setting text to nil.
Revision 14 - Fixed bug that made it impossible to write ~=
Revision 15 - Added myDebug support
Revision 16 - Now indents and highlights for Lua 5.1 syntax. Lua 5.0 syntax is NOT supported. This mostly affects nested comments. Also updated to work with WoW 2.0
Revision 17 - major release:
* internal parser / highlighter / indenter system unchanged
* major rewrite of wow interfacing code, including disabling / enabling
* fixed broken caching mechanism
* fixed problem with MaxLetters and MaxBytes causing text disappearing
* fixed bug with lots of newlines appended when typing an unfinished lua string
* stopped recoloring upon text change - instead, it gets done in an OnUpdate-loop, if the text has been recently changed.
This should significantly improve performance when pasting text. Now the editbox only gets recolored after 0.2 seconds of inactivity
* deprecated, but still working:
- lib.addSmartCode -- replaced by lib.enable
* new functions:
- lib.enable(editbox [, colorTable [, tabWidth]])
- lib.disable(editbox)
* Useful properties to set. Note that after a change, you need to manually call lib.indentEditbox or lib.colorCodeEditbox
for changes to take effect:
- editbox.faiap_colorTable
- editbox.faiap_tabWidth