silikonlucky.blogg.se

Scite editor tutorial
Scite editor tutorial










It will be editor:GetText() - note the colon! So GetText is a plain function, which is passed a string. # Returns number of characters retrieved.įun int GetText=2182(int length, stringresult text) It will be called like this: editor.Length. The 'get' means that there is a read-only property called Length. # Returns the number of characters in the document. The best reference for the Lua Scintilla bindings is scintilla.iface, which is in the Scintilla include directory. Looking up the correct form of a Scintilla function But you can do just about anything with Lua in SciTE! I would suggest that a good way to learn is to experiment using the dofile trick. OK, it's true that SciTE already has such an operation. Because of the savebefore:no, it won't prompt you to save first before executing. Now, after selecting text, you can make it uppercase with Ctrl+M. Put this in a Lua file (say a) in your home directoryĮxt.=$(SciteUserHome)/aĬommand.name.12.*=Make Selection Uppercase Here is an alternative which doesn't require the document to be on disk - it executes all the source in the current buffer:Ĭommand.name.1.*=Run Document as Lua ExtensionĬommand.1.*=dostring dostring(editor:GetText()) There are a lot of these, so consult the documentation. You can rebind a key that has already been defined by SciTE or Scintilla. But you can use any number less than 50 in these definitions, as long as you give an explicit shortcut key: There is a potential problem with this definition some other script may have defined the command 1 you can have commands from 0 to 9 with this method, bound to Ctrl+0. This is a powerful way to begin Lua programming in the SciTE environment. If you have modified this file, then SciTE will prompt you first to save this is the default behaviour.

SCITE EDITOR TUTORIAL MANUAL

(See the section called 'Properties File' in the SciTE manual for a full list of these dynamic properties)Īnd pressed Ctrl+1, "Hello, World" will be shown in the SciTE output window. There can be at most one argument passed to your function, but like anything in a SciTE properties file, it can contain references to other SciTE properties, like FilePath, which is the full path of the currently shown file. In this case, the global Lua function is dofile which has been kept in SciTE's Lua 5 precisely because it's so useful in this case please note that there is no argument list after dofile. command.subsystem must be set to 3, which is the Lua extension.

scite editor tutorial

You will now have a menu item called 'Load Lua' on the Tools menu, and by default it will have a shortcut Ctrl+1. Here is a simple example put this in your properties file (could be local,user or global): These functions appear on the Tools Menu, and may have an associated shortcut key.

scite editor tutorial

Lua-users wiki: Using Lua With Scite Using Lua With SciteĪny global Lua function can be used as a SciTE command.










Scite editor tutorial