This is a plugin for the Geany IDE to provide Lua scripting.
To begin, you should install the plugin and the example scripts. Please read the INSTALL file for more information.
The next time you start Geany, the plugin will look for a directory named geanylua
in the user's plugin directory.
On Linux, this would be: ~/.geany/plugins/geanylua
( Unless you specify another config folder by the geany --config command line.)
Any scripts found in this /plugins/geanylua/ directory will appear in
the Tools->Lua Scripts menu in Geany.
You can create additional scripts yourself, but all script files must have names that end with the .lua file extension. The menu labels are generated from the filenames like this:
No effort is made by the plugin to resolve conflicting accelerators. While these collisions are generally harmless, you should take some effort to make sure you don't create inaccessible (duplicate) mnemonic keys.
Note that if you modify an existing script, the change will take effect immediately, but if you delete an existing script, or add a new script, you must reload the plugin in order for the change to completely take effect. ( The plugin can be reloaded either by restarting Geany, or by toggling it OFF/ON via Geany's Plugin Manager, or by calling the rescan() function from inside a script. )
If there are any sub-directories that contain scripts, these will be recursed to create sub-menus, with two exceptions - folders named events or support will be ignored, these names are considered reserved. The events folder is described below, and the support folder can be used to store arbitrary user data files, modules, etc.
The special directory ./plugins/geanylua/events/
can contain some scripts that
will be invoked whenever the respective event is triggered by Geany.
Currently, there are nine valid filenames for the event scripts:
Note that if any of these nine files exists, it will be executed each time its corresponding event occurs, which will result in some increase in disk activity. In particular, you might notice a delay in startup time with the opened.lua script when you open a bunch of files at once from the commmand line, etc.
Consult the reference page for documentation of the Geany-specific Lua functions.
A complete discussion of the Lua language is way beyond the scope of this plugin package, but there is plenty of information available on the net, For starters, you can check out:
Also, be warned that the plugin does not place any restrictions on what you can or can't do from inside a script. For example, if you decide to call os.exit() from a script, you will end your current Geany session immediately, and any unsaved changes will be lost!
You should also take some caution not to write a script that hangs indefinitely, if this happens, the only way out is to kill the editor.