diff options
Diffstat (limited to 'doc/11_Scripting.md')
-rw-r--r-- | doc/11_Scripting.md | 76 |
1 files changed, 35 insertions, 41 deletions
diff --git a/doc/11_Scripting.md b/doc/11_Scripting.md index 537ca367..44a71db0 100644 --- a/doc/11_Scripting.md +++ b/doc/11_Scripting.md @@ -1,9 +1,8 @@ # Scripting -Textadept is entirely scriptable with Lua. In fact, the editor is mostly written -in Lua. As a result, Textadept has superb support for editing Lua code. Syntax -autocomplete and API documentation is available for many Textadept objects as -well as Lua's standard libraries. The [`lua` module][] also has more tools for +Since Textadept is entirely scriptable with Lua, the editor has superb support +for editing Lua code. Textadept provides syntax autocompletion and documentation +for the Lua and Textadept APIs. The [`lua` module][] also has more tools for working with Lua code.  @@ -16,55 +15,52 @@ working with Lua code. Textadept's API is heavily documented. The [API documentation][] is the ultimate resource on scripting Textadept. There are of course abundant scripting examples -since the editor is written primarily in Lua. +since the editor's internals consist primarily of Lua. [API documentation]: api/index.html ### Generating LuaDoc -You can generate Textadept-like API documentation for your own modules using the +Generate Textadept-like API documentation for your own modules using the *doc/markdowndoc.lua* [LuaDoc][] module (you must have [Discount][] installed): luadoc -d . [-t template_dir] --doclet _HOME/doc/markdowndoc [module(s)] -where `_HOME` is where Textadept is installed and `template_dir` is an optional -template directory that contains two Markdown files: *.header.md* and -*.footer.md*. (See *doc/.header.md* and *doc/.footer.md* for examples.) An -*api/* directory containing the API documentation HTML files is created in the -current directory. +where `_HOME` is the path where you installed Textadept and `template_dir` is an +optional template directory that contains two Markdown files: *.header.md* and +*.footer.md*. (See *doc/.header.md* and *doc/.footer.md* for examples.) LuaDoc +creates an *api/* directory in the current directory that contains the generated +API documentation HTML files. [LuaDoc]: http://keplerproject.github.com/luadoc/ [Discount]: http://www.pell.portland.or.us/~orc/Code/discount/ ## Lua Configuration -[Lua 5.2][] is built into Textadept. It has the same configuration (*luaconf.h*) -as vanilla Lua with the following exceptions: +Textadept contains its own copy of [Lua 5.2][] which has the same configuration +(*luaconf.h*) as vanilla Lua with the following exceptions: -* `TA_LUA_PATH` and `TA_LUA_CPATH` are the environment variable used in place of - the usual `LUA_PATH` and `LUA_CPATH`. +* `TA_LUA_PATH` and `TA_LUA_CPATH` replace the `LUA_PATH` and `LUA_CPATH` + environment variables. * `LUA_ROOT` is "/usr/" in Linux systems instead of "/usr/local/". * `LUA_PATH` and `LUA_CPATH` do not have "./?.lua" and "./?.so" in them. -* All compatibility flags for Lua 5.1 are turned off. (`LUA_COMPAT_UNPACK`, - `LUA_COMPAT_LOADERS`, `LUA_COMPAT_LOG10`, `LUA_COMPAT_LOADSTRING`, - `LUA_COMPAT_MAXN`, and `LUA_COMPAT_MODULE`.) +* No Lua 5.1 compatibility flags are set. [Lua 5.2]: http://www.lua.org/manual/5.2/ ### LuaJIT -Even though Textadept can be run with [LuaJIT][], LuaJIT is based on Lua 5.1 and -is not fully compatible with Lua 5.2. Therefore, modules and scripts should be -written to be compatible with both versions. For the most part, only Lua 5.2's -`_ENV` is not supported by LuaJIT. +Even though Textadept runs with [LuaJIT][], LuaJIT does not fully support +Lua 5.2. Therefore, try to write your modules and scripts to be compatible with +both versions. For the most part, LuaJIT only lacks Lua 5.2's new `_ENV`. [LuaJIT]: http://luajit.org ## Scintilla -The editing component used by Textadept is [Scintilla][]. The [buffer][] part of -Textadept's API is derived from the [Scintilla API][] so any C/C++ code using -Scintilla calls can be ported to Lua without too much trouble. +Textadept uses the [Scintilla][] editing component. The [buffer][] part of +Textadept's API emulates the [Scintilla API][] so porting any C/C++ Scintilla +calls to Lua should not be difficult. [Scintilla]: http://scintilla.org [buffer]: api/buffer.html @@ -72,38 +68,36 @@ Scintilla calls can be ported to Lua without too much trouble. ## Textadept Structure -Because Textadept is mostly written in Lua, its Lua scripts have to be stored in +Because Textadept consists mainly of Lua, its Lua scripts have to be stored in an organized folder structure. ### Core -Textadept's core Lua modules are contained in *core/*. These are absolutely -necessary in order for the application to run. They are responsible for -Textadept's Lua to C interface, event structure, file interactions, and -localization. +The *core/* directory contains Textadept's core Lua modules. These modules are +essential for the application to run. They provide Textadept's Lua to C +interface, event structure, file interactions, and localization. ### Lexers -Lexer modules are responsible for the syntax highlighting of source code. They -are located in *lexers/*. +Lexer modules analyze source code for syntax highlighting. *lexers/* houses +them. ### Modules -Generic and language-specific modules for editing text and source code are -contained in *modules/*. +*modules/* contains generic and language-specific modules for editing text and +source code. ### Themes -Built-in themes to customize the look and behavior of Textadept are located in -*themes/*. +*themes/* has built-in themes that customize the look and feel of Textadept. ### User -User preferences, Lua modules, themes, and user-data are contained in the -*~/.textadept/* folder. This folder may contain *lexers/*, *modules/*, and -*themes/* sub-directories. +The *~/.textadept/* folder houses your preferences, Lua modules, themes, and +user-data. This folder may contain *lexers/*, *modules/*, and *themes/* +sub-directories. ### GTK+ -The *etc/*, *lib/*, and *share/* directories are used by GTK+ and only appear in -the Win32 and Mac OSX packages. +GTK+ uses the *etc/*, *lib/*, and *share/* directories, which only appear in the +Win32 and Mac OSX packages. |