Textadept
- Home |
- Download |
- Lua API |
- Source |
- Language Modules |
- Stats |
- Wiki |
- Mailing List
Contents
_G
Extends Lua’s _G table to provide extra functions and fields.
Fields
OSX
(bool)
If Textadept is running on Mac OSX, this flag is true
.
RESETTING
(bool)
If reset()
has been called, this flag is true
while the Lua
state is being re-initialized.
WIN32
(bool)
If Textadept is running on Windows, this flag is true
.
_CHARSET
(string)
The character set encoding of the filesystem. This is used in File I/O.
_HOME
(string)
Path to the directory containing Textadept.
_LEXERPATH
(string)
Paths to lexers, formatted like
package.path
.
_RELEASE
(string)
The Textadept release version.
_USERHOME
(string)
Path to the user’s ~/.textadept/
.
Functions
new_buffer
()
Creates a new buffer.
Generates a BUFFER_NEW
event.
Return:
- the new buffer.
quit
()
Quits Textadept.
reset
()
Resets the Lua state by reloading all init scripts.
Language-specific modules for opened files are NOT reloaded. Re-opening the
files that use them will reload those modules.
This function is useful for modifying init scripts (such as the user’s
modules/textadept/keys.lua
) on the fly without having to restart Textadept.
_G.RESETTING
is set to true
when re-initing the Lua State. Any scripts
that need to differentiate between startup and reset can utilize this
variable.
See also:
timeout
(interval, f, …)
Calls a given function after an interval of time.
To repeatedly call the function, return true inside the function. A nil
or
false
return value stops repetition.
Parameters:
interval
: The interval in seconds to call the function after.f
: The function to call....
: Additional arguments to pass tof
.
user_dofile
(filename)
Calls dofile()
on the given filename in the user’s Textadept directory.
Errors are printed to the Textadept message buffer.
Parameters:
filename
: The name of the file (not path).
Return:
true
if successful;false
otherwise.
See also:
Tables
_BUFFERS
Table of all open buffers in Textadept. Numeric keys have buffer values and buffer keys have their associated numeric keys.
Usage:
_BUFFERS[1] contains the first buffer.
_BUFFERS[buffer] returns the index of the current buffer in _BUFFERS.
_VIEWS
Table of all views in Textadept. Numeric keys have view values and view keys have their associated numeric keys.
Usage:
_VIEWS[1] contains the first view.
_VIEWS[view] returns the index of the current view in _VIEWS.
arg
Command line parameters.