This may be a stupid question but how do I access things like editor:addtext()?
http://www.scintilla.org/PaneAPI.html
http://www.scintilla.org/SciTELua.html
I can see how to use it, but don't know where to put it. Where are the functions accessible from? And how do they get run? Can it work from any normal Lua program?
Stupid example:
1. Open menu "Options" -> "Open Lua Startup Script"
2. Write any Lua code, e.g. print('Selected: <'..editor:GetSelText()..'>')
3. Press Ctrl-S
(as if you want to save this file), your script will be immediately executed, output will appear in the output pane (on the right).
4. Repeat steps 2-3
SciTEGlobal.properties
ext.lua.startup.script=$(SciteDefaultHome)/your_script.lua
#print length of selected text
command.33.*=PrintSelectionLength
command.subsystem.33.*=3
command.mode.33.*=savebefore:no
command.shortcut.33.*=F1
# User defined key commands
user.shortcuts=\
F1|1133|\
Ctrl+Shift+V|IDM_PASTEANDDOWN|\
Ctrl+PageUp|IDM_PREVFILE|\
Ctrl+PageDown|IDM_NEXTFILE|
user.context.menu=\
Selection Length (F1)|1133|\
||\
Toggle Output|IDM_TOGGLEOUTPUT|
Insert this in your_script.lua
function PrintSelectionLength()
local sel = editor:GetSelText()
print(#sel..' chars selected')
print(table.concat({sel:byte(1,-1)},','))
end
Now you can press F1
to see ASCII codes of symbols under selection while editing any file in SciTE.