aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--core/._G.luadoc88
-rw-r--r--core/.command_entry.luadoc16
-rw-r--r--core/.find.luadoc76
-rw-r--r--core/.gui.luadoc124
-rw-r--r--core/args.lua17
-rw-r--r--core/events.lua40
-rw-r--r--core/file_io.lua43
-rw-r--r--core/gui.lua132
-rw-r--r--core/iface.lua22
-rw-r--r--core/init.lua108
-rw-r--r--core/keys.lua25
-rw-r--r--core/locale.lua10
-rw-r--r--doc/manual/11_Scripting.md11
-rw-r--r--doc/manual/14_Appendix.md11
-rw-r--r--doc/manual/7_Modules.md4
-rw-r--r--doc/manual/9_Preferences.md25
-rw-r--r--modules/cpp/init.lua28
-rw-r--r--modules/cpp/lua_api189
-rw-r--r--modules/lua/init.lua59
-rw-r--r--modules/lua/lua.luadoc1036
-rw-r--r--modules/textadept/adeptsense.lua64
-rw-r--r--modules/textadept/bookmarks.lua38
-rw-r--r--modules/textadept/command_entry.lua18
-rw-r--r--modules/textadept/editing.lua111
-rw-r--r--modules/textadept/filter_through.lua10
-rw-r--r--modules/textadept/find.lua86
-rw-r--r--modules/textadept/init.lua30
-rw-r--r--modules/textadept/keys.lua74
-rw-r--r--modules/textadept/menu.lua33
-rw-r--r--modules/textadept/mime_types.lua43
-rw-r--r--modules/textadept/run.lua30
-rw-r--r--modules/textadept/session.lua50
-rw-r--r--modules/textadept/snapopen.lua30
-rw-r--r--modules/textadept/snippets.lua27
-rwxr-xr-xscripts/gen_iface.lua22
35 files changed, 1611 insertions, 1119 deletions
diff --git a/core/._G.luadoc b/core/._G.luadoc
deleted file mode 100644
index 09749436..00000000
--- a/core/._G.luadoc
+++ /dev/null
@@ -1,88 +0,0 @@
--- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
--- This is a DUMMY FILE used for making LuaDoc for built-in functions in the
--- _G table.
-
---- Extends Lua's _G table to provide extra functions and fields.
-module('_G')
-
--- Markdown:
--- ## Fields
---
--- * `_HOME` [string]: Path to the directory containing Textadept.
--- * `_LEXERPATH` [string]: Paths to lexers, formatted like
--- [`package.path`][package_path].
--- * `_RELEASE` [string]: The Textadept release version.
--- * `_USERHOME` [string]: Path to the user's `~/.textadept/`.
--- * `_CHARSET` [string]: The character set encoding of the filesystem. This is
--- used in [File I/O](../modules/io.html).
--- * `RESETTING` [bool]: If [`reset()`](../modules/_G.html#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`.
--- * `OSX` [bool]: If Textadept is running on Mac OSX, this flag is `true`.
---
--- [package_path]: http://www.lua.org/manual/5.1/manual.html#pdf-package.path
-
----
--- Command line parameters.
--- @class table
--- @name arg
-arg = {}
-
-
----
--- Table of all open buffers in Textadept.
--- Numeric keys have buffer values and buffer keys have their associated numeric
--- keys.
--- @class table
--- @name _BUFFERS
--- @usage _BUFFERS[1] contains the first buffer.
--- @usage _BUFFERS[buffer] returns the index of the current buffer in _BUFFERS.
-_BUFFERS = {}
-
----
--- Table of all views in Textadept.
--- Numeric keys have view values and view keys have their associated numeric
--- keys.
--- @class table
--- @name _VIEWS
--- @usage _VIEWS[1] contains the first view.
--- @usage _VIEWS[view] returns the index of the current view in _VIEWS.
-_VIEWS = {}
-
----
--- Creates a new buffer.
--- Generates a `BUFFER_NEW` event.
--- @return the new buffer.
-function new_buffer() end
-
----
--- 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.
--- @param interval The interval in seconds to call the function after.
--- @param f The function to call.
--- @param ... Additional arguments to pass to `f`.
-function timeout(interval, f, ...) end
-
----
--- 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.
-function reset() end
-
----
--- Quits Textadept.
-function quit() end
-
----
--- Calls `dofile()` on the given filename in the user's Textadept directory.
--- Errors are printed to the Textadept message buffer.
--- @param filename The name of the file (not path).
--- @return true if successful; false otherwise.
--- @see dofile
-function user_dofile(filename) end
diff --git a/core/.command_entry.luadoc b/core/.command_entry.luadoc
deleted file mode 100644
index 3dbab4ba..00000000
--- a/core/.command_entry.luadoc
+++ /dev/null
@@ -1,16 +0,0 @@
--- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
--- This is a DUMMY FILE used for making LuaDoc for built-in functions in the
--- global gui.command_entry table.
-
----
--- Textadept's Command entry.
-module('gui.command_entry')
-
--- Markdown:
--- ## Fields
---
--- * `entry_text` [string]: The text in the entry.
-
----
--- Focuses the command entry.
-function focus() end
diff --git a/core/.find.luadoc b/core/.find.luadoc
deleted file mode 100644
index 605cee59..00000000
--- a/core/.find.luadoc
+++ /dev/null
@@ -1,76 +0,0 @@
--- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
--- This is a DUMMY FILE used for making LuaDoc for built-in functions in the
--- global gui.find table.
-
----
--- Textadept's integrated find/replace dialog.
-module('gui.find')
-
--- Markdown:
--- ## Fields
---
--- * `find_entry_text` [string]: The text in the find entry.
--- * `replace_entry_text` [string]: The text in the replace entry.
--- * `match_case` [bool]: Searches are case-sensitive.
--- * `whole_word` [bool]: Only whole-word matches are allowed in searches.
--- * `lua` [bool]: The search text is interpreted as a Lua pattern.
--- * `in_files` [bool]: Search for the text in a list of files.
--- * `find_label_text` [string]: The text of the 'Find' label. This is primarily
--- used for localization. (Write-only)
--- * `replace_label_text` [string]: The text of the 'Replace' label. This is
--- primarily used for localization. (Write-only)
--- * `find_next_button_text` [string]: The text of the 'Find Next' button. This
--- is primarily used for localization. (Write-only)
--- * `find_prev_button_text` [string]: The text of the 'Find Prev' button. This
--- is primarily used for localization. (Write-only)
--- * `replace_button_text` [string]: The text of the 'Replace' button. This is
--- primarily used for localization. (Write-only)
--- * `replace_all_button_text` [string]: The text of the 'Replace All' button.
--- This is primarily used for localization. (Write-only)
--- * `match_case_label_text` [string]: The text of the 'Match case' label. This
--- is primarily used for localization. (Write-only)
--- * `whole_word_label_text` [string]: The text of the 'Whole word' label. This
--- is primarily used for localization. (Write-only)
--- * `lua_pattern_label_text` [string]: The text of the 'Lua pattern' label.
--- This is primarily used for localization. (Write-only)
--- * `in_files_label_text` [string]: The text of the 'In files' label. This is
--- primarily used for localization. (Write-only)
-
----
--- Displays and focuses the find/replace dialog.
-function focus() end
-
----
--- Mimicks a press of the 'Find Next' button in the Find box.
-function find_next() end
-
----
--- Mimicks a press of the 'Find Prev' button in the Find box.
-function find_prev() end
-
----
--- Mimicks a press of the 'Replace' button in the Find box.
-function replace() end
-
----
--- Mimicks a press of the 'Replace All' button in the Find box.
-function replace_all() end
-
----
--- Goes to the next or previous file found relative to the file
--- on the current line.
--- @param next Flag indicating whether or not to go to the next file.
-function goto_file_in_list(next) end
-
----
--- Begins an incremental find using the Lua command entry.
--- Lua command functionality will be unavailable until the search is finished
--- (pressing 'Escape' by default).
-function find_incremental() end
-
----
--- Performs a find in files with the given directory.
--- Use the `gui.find` fields to set the text to find and option flags.
--- @param utf8_dir UTF-8 encoded directory name. If none is provided, the user
--- is prompted for one.
-function find_in_files(utf8_dir) end
diff --git a/core/.gui.luadoc b/core/.gui.luadoc
deleted file mode 100644
index 94edc031..00000000
--- a/core/.gui.luadoc
+++ /dev/null
@@ -1,124 +0,0 @@
--- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
--- This is a DUMMY FILE used for making LuaDoc for built-in functions in the
--- global gui table.
-
---- The core gui table.
-module('gui')
-
--- Markdown:
--- ## Fields
---
--- * `title` [string]: The title of the Textadept window.
--- * `menubar` [table]: A table of GTK menus defining a menubar. (Write-only)
--- * `context_menu`: A GTK menu defining the editor's context menu.
--- * `clipboard_text` [string]: The text on the clipboard. (Read-only)
--- * `statusbar_text` [string]: The text displayed by the statusbar.
--- * `docstatusbar_text` [string]: The text displayed by the doc statusbar.
--- (Write-only)
--- * `size` [table]: The size of the Textadept window (`{ width, height }`).
-
----
--- Goes to the specified view.
--- Generates `VIEW_BEFORE_SWITCH` and `VIEW_AFTER_SWITCH` events.
--- @param n A relative or absolute view index.
--- @param relative Flag indicating if n is a relative index or not. Defaults to
--- false.
-function goto_view(n, relative) end
-
----
--- Goes to the buffer with the given filename.
--- If the desired buffer is open in a view, goes to that view. Otherwise, opens
--- the buffer in either the `preferred_view` if given, the first view that is
--- not the current one, a split view if `split` is `true`, or the current view.
--- @param filename The filename of the buffer to go to.
--- @param split If there is only one view, split it and open the buffer in the
--- other view.
--- @param preferred_view When multiple views exist and the desired buffer is not
--- open in any of them, open it in this one.
-function goto_file(filename, split, preferred_view) end
-
----
--- Gets the current split view structure.
--- @return table of split views. Each split view entry is a table with 4
--- fields: `1`, `2`, `vertical`, and `size`. `1` and `2` have values of either
--- split view entries or the index of the buffer shown in each view;
--- `vertical` is a flag indicating if the split is vertical or not; and
--- `size` is the integer position of the split resizer.
-function get_split_table() end
-
----
--- Creates a GTK menu, returning the userdata.
--- @param menu_table A table defining the menu. It is an ordered list of tables
--- with a string menu item, integer menu ID, and optional keycode and modifier
--- mask. The latter two are used to display key shortcuts in the menu. The
--- string menu item is handled as follows:
--- `'gtk-*'` - a stock menu item is created based on the GTK stock-id.
--- `'separator'` - a menu separator item is created.
--- Otherwise a regular menu item with a mnemonic is created.
--- Submenus are just nested menu-structure tables. Their title text is defined
--- with a `title` key.
--- @see keys.get_gdk_key
-function gtkmenu(menu_table) end
-
----
--- Helper function for printing messages to buffers.
--- Splits the view and opens a new buffer for printing messages. If the message
--- buffer is already open and a view is currently showing it, the message is
--- printed to that view. Otherwise the view is split, goes to the open message
--- buffer, and prints to it.
--- @param buffer_type String type of message buffer.
--- @param ... Message strings.
--- @usage gui._print(L('[Error Buffer]'), error_message)
--- @usage gui._print(L('[Message Buffer]'), message)
-function _print(buffer_type, ...) end
-
----
--- Prints messages to the Textadept message buffer.
--- Opens a new buffer (if one has not already been opened) for printing
--- messages.
--- @param ... Message strings.
-function print(...) end
-
----
--- Displays a dialog with a list of buffers to switch to and switches to the
--- selected one, if any.
-function switch_buffer() end
-
----
--- Displays a gcocoadialog of a specified type with the given string arguments.
--- Each argument is like a string in Lua's `arg` table. Tables of strings are
--- allowed as arguments and are expanded in place. This is useful for
--- filteredlist dialogs with many items.
--- @return string gcocoadialog result.
-function dialog(kind, ...) end
-
----
--- Shortcut function for `gui.dialog('filtered_list', ...)` with 'Ok' and
--- 'Cancel' buttons.
--- @param title The title for the filteredlist dialog.
--- @param columns A column name or list of column names.
--- @param items An item or list of items.
--- @param int_return If `true`, returns the integer index of the selected item
--- in the filteredlist. Defaults to `false`, which returns the string item.
--- Not compatible with a `'--select-multiple'` filteredlist.
--- @param ... Additional parameters to pass to `gui.dialog()`.
--- @return Either a string or integer on success; `nil` otherwise.
--- @usage gui.filteredlist('Title', 'Foo', { 'Bar', 'Baz' })
--- @usage gui.filteredlist('Title', { 'Foo', 'Bar' }, { 'a', 'b', 'c', 'd' },
--- false, '--output-column', '2')
-function filteredlist(title, columns, items, int_return, ...) end
-
----
--- Sets the editor theme from the given name.
--- Themes in `_USERHOME/themes/` are checked first, followed by `_HOME/themes/`.
--- If the name contains slashes ('/' on Linux and Mac OSX and '\' on Win32), it
--- is assumed to be an absolute path so `_USERHOME` and `_HOME` are not checked.
--- Throws an error if the theme is not found. Any errors in the theme are
--- printed to `io.stderr`.
--- @param name The name or absolute path of a theme. If nil, sets the default
--- theme.
-function set_theme(name) end
-
----
--- Prompts the user to select an editor theme from a filtered list.
-function select_theme() end
diff --git a/core/args.lua b/core/args.lua
index 6a65bde5..8d305db7 100644
--- a/core/args.lua
+++ b/core/args.lua
@@ -1,8 +1,11 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Processes command line arguments for Textadept.
-module('args', package.seeall)
+module('args', package.seeall)]]
-- Markdown:
-- ## Arg Events
@@ -24,7 +27,8 @@ local switches = {}
-- @param narg The number of expected parameters for the switch.
-- @param f The Lua function to run when the switch is tripped.
-- @param description Description of the switch.
-function register(switch1, switch2, narg, f, description)
+-- @name register
+function M.register(switch1, switch2, narg, f, description)
local t = { f, narg, description }
switches[switch1], switches[switch2] = t, t
end
@@ -35,7 +39,8 @@ end
-- are treated as filepaths and opened.
-- Generates an `'arg_none'` event when no args are present.
-- @see register
-function process()
+-- @name process
+function M.process()
local no_args = true
local i = 1
while i <= #arg do
@@ -62,7 +67,7 @@ local function show_help()
for k, v in pairs(switches) do print(line:format(k, table.unpack(v, 2))) end
os.exit()
end
-register('-h', '--help', 0, show_help, 'Displays this')
+M.register('-h', '--help', 0, show_help, 'Displays this')
-- For Windows, create arg table from single command line string (arg[0]).
if WIN32 and #arg[0] > 0 then
@@ -90,4 +95,6 @@ if not lfs.attributes(userhome..'/init.lua') then
end
_G._USERHOME = userhome
-register('-u', '--userhome', 1, function() end, 'Sets alternate _USERHOME')
+M.register('-u', '--userhome', 1, function() end, 'Sets alternate _USERHOME')
+
+return M
diff --git a/core/events.lua b/core/events.lua
index d6a7b270..e0f10ebe 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -2,9 +2,12 @@
local L = locale.localize
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Textadept's core event structure and handlers.
-module('events', package.seeall)
+module('events', package.seeall)]]
-- Markdown:
-- ## Overview
@@ -181,9 +184,7 @@ module('events', package.seeall)
-- A table of event names and a table of functions connected to them.
-- @class table
-- @name handlers
-handlers = {}
-
-local handlers = handlers
+M.handlers = {}
---
-- Adds a handler function to an event.
@@ -193,10 +194,11 @@ local handlers = handlers
-- @param index Optional index to insert the handler into.
-- @return Index of handler.
-- @see disconnect
-function connect(event, f, index)
+-- @name connect
+function M.connect(event, f, index)
if not event then error(L('Undefined event name')) end
- if not handlers[event] then handlers[event] = {} end
- local h = handlers[event]
+ if not M.handlers[event] then M.handlers[event] = {} end
+ local h = M.handlers[event]
if index then table.insert(h, index, f) else h[#h + 1] = f end
return index or #h
end
@@ -206,9 +208,10 @@ end
-- @param event The string event name.
-- @param index Index of the handler (returned by `events.connect()`).
-- @see connect
-function disconnect(event, index)
- if not handlers[event] then return end
- table.remove(handlers[event], index)
+-- @name disconnect
+function M.disconnect(event, index)
+ if not M.handlers[event] then return end
+ table.remove(M.handlers[event], index)
end
local error_emitted = false
@@ -222,9 +225,10 @@ local error_emitted = false
-- @param ... Arguments passed to the handler.
-- @return `true` or `false` if any handler explicitly returned such; nil
-- otherwise.
-function emit(event, ...)
+-- @name emit
+function M.emit(event, ...)
if not event then error(L('Undefined event name')) end
- local h = handlers[event]
+ local h = M.handlers[event]
if not h then return end
local pcall, table_unpack, type = pcall, table.unpack, type
for i = 1, #h do
@@ -232,7 +236,7 @@ function emit(event, ...)
if not ok then
if not error_emitted then
error_emitted = true
- emit(events.ERROR, result)
+ M.emit(events.ERROR, result)
error_emitted = false
else
io.stderr:write(result)
@@ -271,16 +275,16 @@ local scnotifications = {
}
-- Handles Scintilla notifications.
-connect('SCN', function(n)
+M.connect('SCN', function(n)
local f = scnotifications[n.code]
if not f then return end
local args = {}
for i = 2, #f do args[i - 1] = n[f[i]] end
- return emit(f[1], table.unpack(args))
+ return M.emit(f[1], table.unpack(args))
end)
-- Set event constants.
-for _, n in pairs(scnotifications) do _M[n[1]:upper()] = n[1] end
+for _, n in pairs(scnotifications) do M[n[1]:upper()] = n[1] end
local ta_events = {
'appleevent_odoc', 'buffer_after_switch', 'buffer_before_switch',
'buffer_deleted', 'buffer_new', 'command_entry_command',
@@ -288,4 +292,6 @@ local ta_events = {
'replace', 'replace_all', 'reset_after', 'reset_before', 'view_after_switch',
'view_before_switch', 'view_new'
}
-for _, e in pairs(ta_events) do _M[e:upper()] = e end
+for _, e in pairs(ta_events) do M[e:upper()] = e end
+
+return M
diff --git a/core/file_io.lua b/core/file_io.lua
index 602c0f19..f1f44f48 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -3,9 +3,10 @@
local L = locale.localize
local events = events
+--[[ This comment is for LuaDoc.
---
-- Extends Lua's io package to provide file input/output routines for Textadept.
-module('io', package.seeall)
+module('io', package.seeall)]]
-- Markdown:
-- ## Converting Filenames to and from UTF-8
@@ -53,13 +54,13 @@ events.FILE_SAVED_AS = 'file_saved_as'
-- The most recent are towards the top.
-- @class table
-- @name recent_files
-recent_files = {}
+io.recent_files = {}
---
-- List of byte-order marks (BOMs).
-- @class table
-- @name boms
-boms = {
+io.boms = {
['UTF-16BE'] = string.char(254, 255),
['UTF-16LE'] = string.char(255, 254),
['UTF-32BE'] = string.char(0, 0, 254, 255),
@@ -76,13 +77,13 @@ local function detect_encoding(text)
if b1 == 239 and b2 == 187 and b3 == 191 then
return 'UTF-8', string.char(239, 187, 191)
elseif b1 == 254 and b2 == 255 then
- return 'UTF-16BE', boms['UTF-16BE']
+ return 'UTF-16BE', io.boms['UTF-16BE']
elseif b1 == 255 and b2 == 254 then
- return 'UTF-16LE', boms['UTF-16LE']
+ return 'UTF-16LE', io.boms['UTF-16LE']
elseif b1 == 0 and b2 == 0 and b3 == 254 and b4 == 255 then
- return 'UTF-32BE', boms['UTF-32BE']
+ return 'UTF-32BE', io.boms['UTF-32BE']
elseif b1 == 255 and b2 == 254 and b3 == 0 and b4 == 0 then
- return 'UTF-32LE', boms['UTF-32LE']
+ return 'UTF-32LE', io.boms['UTF-32LE']
else
local chunk = #text > 65536 and text:sub(1, 65536) or text
if chunk:find('\0') then return 'binary' end -- binary file
@@ -94,14 +95,15 @@ end
-- List of encodings to try to decode files as after UTF-8.
-- @class table
-- @name try_encodings
-try_encodings = { 'UTF-8', 'ASCII', 'ISO-8859-1', 'MacRoman' }
+io.try_encodings = { 'UTF-8', 'ASCII', 'ISO-8859-1', 'MacRoman' }
---
-- Opens a list of files.
-- @param utf8_filenames A `\n` separated list of UTF-8-encoded filenames to
-- open. If `nil`, the user is prompted with a fileselect dialog.
-- @usage io.open_file(utf8_encoded_filename)
-function open_file(utf8_filenames)
+-- @name open_file
+function io.open_file(utf8_filenames)
utf8_filenames = utf8_filenames or
gui.dialog('fileselect',
'--title', L('Open'),
@@ -130,7 +132,7 @@ function open_file(utf8_filenames)
text = text:iconv('UTF-8', encoding)
else
-- Try list of encodings.
- for _, try_encoding in ipairs(try_encodings) do
+ for _, try_encoding in ipairs(io.try_encodings) do
local ok, conv = pcall(string.iconv, text, 'UTF-8', try_encoding)
if ok then encoding, text = try_encoding, conv break end
end
@@ -158,10 +160,10 @@ function open_file(utf8_filenames)
events.emit(events.FILE_OPENED, utf8_filename)
-- Add file to recent files list, eliminating duplicates.
- for i, file in ipairs(recent_files) do
- if file == utf8_filename then table.remove(recent_files, i) break end
+ for i, file in ipairs(io.recent_files) do
+ if file == utf8_filename then table.remove(io.recent_files, i) break end
end
- table.insert(recent_files, 1, utf8_filename)
+ table.insert(io.recent_files, 1, utf8_filename)
lfs.chdir(utf8_filename:iconv(_CHARSET, 'UTF-8'):match('.+[/\\]') or '.')
end
end
@@ -201,7 +203,7 @@ local function set_encoding(buffer, encoding)
buffer:add_text(text, #text)
buffer:line_scroll(0, first_visible_line)
buffer:goto_pos(pos)
- buffer.encoding, buffer.encoding_bom = encoding, boms[encoding]
+ buffer.encoding, buffer.encoding_bom = encoding, io.boms[encoding]
end
-- LuaDoc is in core/.buffer.luadoc.
@@ -249,7 +251,8 @@ end
---
-- Saves all dirty buffers to their respective files.
-- @usage io.save_all()
-function save_all()
+-- @name save_all
+function io.save_all()
local current_buffer = _BUFFERS[buffer]
for i, buffer in ipairs(_BUFFERS) do
view:goto_buffer(i)
@@ -282,7 +285,8 @@ end
-- saved automatically. They must be saved manually.
-- @usage io.close_all()
-- @return true if user did not cancel.
-function close_all()
+-- @name close_all
+function io.close_all()
while #_BUFFERS > 1 do
view:goto_buffer(#_BUFFERS)
if not buffer:close() then return false end
@@ -338,7 +342,8 @@ end)
---
-- Prompts the user to open a recently opened file.
-function open_recent_file()
- local i = gui.filteredlist(L('Open'), L('File'), recent_files, true)
- if i then open_file(recent_files[i + 1]) end
+-- @name open_recent_file
+function io.open_recent_file()
+ local i = gui.filteredlist(L('Open'), L('File'), io.recent_files, true)
+ if i then open_file(io.recent_files[i + 1]) end
end
diff --git a/core/gui.lua b/core/gui.lua
index a629020a..9e657d45 100644
--- a/core/gui.lua
+++ b/core/gui.lua
@@ -3,6 +3,22 @@
local L = locale.localize
local gui = gui
+--[[ This comment is for LuaDoc.
+--- The core gui table.
+module('gui')]]
+
+-- Markdown:
+-- ## Fields
+--
+-- * `title` [string]: The title of the Textadept window.
+-- * `menubar` [table]: A table of GTK menus defining a menubar. (Write-only)
+-- * `context_menu`: A GTK menu defining the editor's context menu.
+-- * `clipboard_text` [string]: The text on the clipboard. (Read-only)
+-- * `statusbar_text` [string]: The text displayed by the statusbar.
+-- * `docstatusbar_text` [string]: The text displayed by the doc statusbar.
+-- (Write-only)
+-- * `size` [table]: The size of the Textadept window (`{ width, height }`).
+
-- Helper function for printing messages to buffers.
-- @see gui._print
local function _print(buffer_type, ...)
@@ -28,13 +44,42 @@ local function _print(buffer_type, ...)
buffer:goto_pos(buffer.length)
buffer:set_save_point()
end
--- LuaDoc is in core/.gui.luadoc.
+---
+-- Helper function for printing messages to buffers.
+-- Splits the view and opens a new buffer for printing messages. If the message
+-- buffer is already open and a view is currently showing it, the message is
+-- printed to that view. Otherwise the view is split, goes to the open message
+-- buffer, and prints to it.
+-- @param buffer_type String type of message buffer.
+-- @param ... Message strings.
+-- @usage gui._print(L('[Error Buffer]'), error_message)
+-- @usage gui._print(L('[Message Buffer]'), message)
+-- @name _print
function gui._print(buffer_type, ...) pcall(_print, buffer_type, ...) end
--- LuaDoc is in core/.gui.luadoc.
+---
+-- Prints messages to the Textadept message buffer.
+-- Opens a new buffer (if one has not already been opened) for printing
+-- messages.
+-- @param ... Message strings.
+-- @name print
function gui.print(...) gui._print(L('[Message Buffer]'), ...) end
--- LuaDoc is in core/.gui.luadoc.
+---
+-- Shortcut function for `gui.dialog('filtered_list', ...)` with 'Ok' and
+-- 'Cancel' buttons.
+-- @param title The title for the filteredlist dialog.
+-- @param columns A column name or list of column names.
+-- @param items An item or list of items.
+-- @param int_return If `true`, returns the integer index of the selected item
+-- in the filteredlist. Defaults to `false`, which returns the string item.
+-- Not compatible with a `'--select-multiple'` filteredlist.
+-- @param ... Additional parameters to pass to `gui.dialog()`.
+-- @return Either a string or integer on success; `nil` otherwise.
+-- @usage gui.filteredlist('Title', 'Foo', { 'Bar', 'Baz' })
+-- @usage gui.filteredlist('Title', { 'Foo', 'Bar' }, { 'a', 'b', 'c', 'd' },
+-- false, '--output-column', '2')
+-- @name filteredlist
function gui.filteredlist(title, columns, items, int_return, ...)
local out = gui.dialog('filteredlist',
'--title', title,
@@ -52,7 +97,10 @@ function gui.filteredlist(title, columns, items, int_return, ...)
end
end
--- LuaDoc is in core/.gui.luadoc.
+---
+-- Displays a dialog with a list of buffers to switch to and switches to the
+-- selected one, if any.
+-- @name switch_buffer
function gui.switch_buffer()
local columns, items = { L('Name'), L('File') }, {}
for _, buffer in ipairs(_BUFFERS) do
@@ -64,7 +112,17 @@ function gui.switch_buffer()
if i then view:goto_buffer(i + 1) end
end
--- LuaDoc is in core/.gui.luadoc.
+---
+-- Goes to the buffer with the given filename.
+-- If the desired buffer is open in a view, goes to that view. Otherwise, opens
+-- the buffer in either the `preferred_view` if given, the first view that is
+-- not the current one, a split view if `split` is `true`, or the current view.
+-- @param filename The filename of the buffer to go to.
+-- @param split If there is only one view, split it and open the buffer in the
+-- other view.
+-- @param preferred_view When multiple views exist and the desired buffer is not
+-- open in any of them, open it in this one.
+-- @name goto_file
function gui.goto_file(filename, split, preferred_view)
if #_VIEWS == 1 and view.buffer.filename ~= filename and split then
view:split()
@@ -80,7 +138,16 @@ function gui.goto_file(filename, split, preferred_view)
end
local THEME
--- LuaDoc is in core/.gui.luadoc.
+---
+-- Sets the editor theme from the given name.
+-- Themes in `_USERHOME/themes/` are checked first, followed by `_HOME/themes/`.
+-- If the name contains slashes ('/' on Linux and Mac OSX and '\' on Win32), it
+-- is assumed to be an absolute path so `_USERHOME` and `_HOME` are not checked.
+-- Throws an error if the theme is not found. Any errors in the theme are
+-- printed to `io.stderr`.
+-- @param name The name or absolute path of a theme. If nil, sets the default
+-- theme.
+-- @name set_theme
function gui.set_theme(name)
if not name then
-- Read theme from ~/.textadept/theme, defaulting to 'light'.
@@ -130,7 +197,9 @@ function gui.set_theme(name)
THEME = theme
end
--- LuaDoc is in core/.gui.luadoc.
+---
+-- Prompts the user to select an editor theme from a filtered list.
+-- @name select_theme
function gui.select_theme()
local themes, themes_found = {}, {}
for theme in lfs.dir(_HOME..'/themes') do
@@ -337,3 +406,52 @@ connect(events.QUIT, function()
end)
connect(events.ERROR, function(...) gui._print(L('[Error Buffer]'), ...) end)
+
+-- The functions below are Lua C functions.
+
+---
+-- Displays a gcocoadialog of a specified type with the given string arguments.
+-- Each argument is like a string in Lua's `arg` table. Tables of strings are
+-- allowed as arguments and are expanded in place. This is useful for
+-- filteredlist dialogs with many items.
+-- @return string gcocoadialog result.
+-- @class function
+-- @name dialog
+local dialog
+
+---
+-- Gets the current split view structure.
+-- @return table of split views. Each split view entry is a table with 4
+-- fields: `1`, `2`, `vertical`, and `size`. `1` and `2` have values of either
+-- split view entries or the index of the buffer shown in each view;
+-- `vertical` is a flag indicating if the split is vertical or not; and
+-- `size` is the integer position of the split resizer.
+-- @class function
+-- @name get_split_table
+local get_split_table
+
+---
+-- Goes to the specified view.
+-- Generates `VIEW_BEFORE_SWITCH` and `VIEW_AFTER_SWITCH` events.
+-- @param n A relative or absolute view index.
+-- @param relative Flag indicating if n is a relative index or not. Defaults to
+-- false.
+-- @class function
+-- @name goto_view
+local goto_view
+
+---
+-- Creates a GTK menu, returning the userdata.
+-- @param menu_table A table defining the menu. It is an ordered list of tables
+-- with a string menu item, integer menu ID, and optional keycode and modifier
+-- mask. The latter two are used to display key shortcuts in the menu. The
+-- string menu item is handled as follows:
+-- `'gtk-*'` - a stock menu item is created based on the GTK stock-id.
+-- `'separator'` - a menu separator item is created.
+-- Otherwise a regular menu item with a mnemonic is created.
+-- Submenus are just nested menu-structure tables. Their title text is defined
+-- with a `title` key.
+-- @see keys.get_gdk_key
+-- @class function
+-- @name gtkmenu
+local gtkmenu
diff --git a/core/iface.lua b/core/iface.lua
index cc4d6bb4..a8048f82 100644
--- a/core/iface.lua
+++ b/core/iface.lua
@@ -1,27 +1,30 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Scintilla constants, functions, and properties.
-- Do not modify anything in this module. Doing so will result in instability.
-module('_SCINTILLA')
+module('_SCINTILLA')]]
---
-- Scintilla constants.
-- @class table
-- @name constants
-constants = {ANNOTATION_BOXED=2,ANNOTATION_HIDDEN=0,ANNOTATION_STANDARD=1,CARETSTYLE_BLOCK=2,CARETSTYLE_INVISIBLE=0,CARETSTYLE_LINE=1,CARET_EVEN=0x08,CARET_JUMPS=0x10,CARET_SLOP=0x01,CARET_STRICT=0x04,EDGE_BACKGROUND=2,EDGE_LINE=1,EDGE_NONE=0,INDIC0_MASK=0x20,INDIC1_MASK=0x40,INDIC2_MASK=0x80,INDICS_MASK=0xE0,INDIC_BOX=6,INDIC_CONTAINER=8,INDIC_DASH=9,INDIC_DIAGONAL=3,INDIC_DOTBOX=12,INDIC_DOTS=10,INDIC_HIDDEN=5,INDIC_MAX=31,INDIC_PLAIN=0,INDIC_ROUNDBOX=7,INDIC_SQUIGGLE=1,INDIC_SQUIGGLELOW=11,INDIC_STRAIGHTBOX=8,INDIC_STRIKE=4,INDIC_TT=2,INVALID_POSITION=-1,KEYWORDSET_MAX=8,MARKER_MAX=31,SCEN_CHANGE=768,SCEN_KILLFOCUS=256,SCEN_SETFOCUS=512,SCFIND_MATCHCASE=4,SCFIND_POSIX=0x00400000,SCFIND_REGEXP=0x00200000,SCFIND_WHOLEWORD=2,SCFIND_WORDSTART=0x00100000,SCI_ANNOTATIONGETLINES=2546,SCI_ANNOTATIONGETSTYLE=2543,SCI_ANNOTATIONGETSTYLEOFFSET=2551,SCI_ANNOTATIONGETVISIBLE=2549,SCI_ANNOTATIONSETSTYLE=2542,SCI_ANNOTATIONSETSTYLEOFFSET=2550,SCI_ANNOTATIONSETVISIBLE=2548,SCI_AUTOCGETAUTOHIDE=2119,SCI_AUTOCGETCANCELATSTART=2111,SCI_AUTOCGETCHOOSESINGLE=2114,SCI_AUTOCGETDROPRESTOFWORD=2271,SCI_AUTOCGETIGNORECASE=2116,SCI_AUTOCGETMAXHEIGHT=2211,SCI_AUTOCGETMAXWIDTH=2209,SCI_AUTOCGETSEPARATOR=2107,SCI_AUTOCGETTYPESEPARATOR=2285,SCI_AUTOCSETAUTOHIDE=2118,SCI_AUTOCSETCANCELATSTART=2110,SCI_AUTOCSETCHOOSESINGLE=2113,SCI_AUTOCSETDROPRESTOFWORD=2270,SCI_AUTOCSETFILLUPS=2112,SCI_AUTOCSETIGNORECASE=2115,SCI_AUTOCSETMAXHEIGHT=2210,SCI_AUTOCSETMAXWIDTH=2208,SCI_AUTOCSETSEPARATOR=2106,SCI_AUTOCSETTYPESEPARATOR=2286,SCI_CALLTIPSETBACK=2205,SCI_CALLTIPSETFORE=2206,SCI_CALLTIPSETFOREHLT=2207,SCI_CALLTIPSETPOSITION=2213,SCI_CALLTIPUSESTYLE=2212,SCI_GETADDITIONALCARETFORE=2605,SCI_GETADDITIONALCARETSBLINK=2568,SCI_GETADDITIONALCARETSVISIBLE=2609,SCI_GETADDITIONALSELALPHA=2603,SCI_GETADDITIONALSELECTIONTYPING=2566,SCI_GETALLLINESVISIBLE=2236,SCI_GETANCHOR=2009,SCI_GETBACKSPACEUNINDENTS=2263,SCI_GETBUFFEREDDRAW=2034,SCI_GETCARETFORE=2138,SCI_GETCARETLINEBACK=2097,SCI_GETCARETLINEBACKALPHA=2471,SCI_GETCARETLINEVISIBLE=2095,SCI_GETCARETPERIOD=2075,SCI_GETCARETSTICKY=2457,SCI_GETCARETSTYLE=2513,SCI_GETCARETWIDTH=2189,SCI_GETCHARACTERPOINTER=2520,SCI_GETCHARAT=2007,SCI_GETCODEPAGE=2137,SCI_GETCOLUMN=2129,SCI_GETCONTROLCHARSYMBOL=2389,SCI_GETCURRENTPOS=2008,SCI_GETCURSOR=2387,SCI_GETDIRECTFUNCTION=2184,SCI_GETDIRECTPOINTER=2185,SCI_GETDOCPOINTER=2357,SCI_GETEDGECOLOUR=2364,SCI_GETEDGECOLUMN=2360,SCI_GETEDGEMODE=2362,SCI_GETENDATLASTLINE=2278,SCI_GETENDSTYLED=2028,SCI_GETEOLMODE=2030,SCI_GETEXTRAASCENT=2526,SCI_GETEXTRADESCENT=2528,SCI_GETFIRSTVISIBLELINE=2152,SCI_GETFOCUS=2381,SCI_GETFOLDEXPANDED=2230,SCI_GETFOLDLEVEL=2223,SCI_GETFOLDPARENT=2225,SCI_GETFONTQUALITY=2612,SCI_GETHIGHLIGHTGUIDE=2135,SCI_GETHOTSPOTACTIVEUNDERLINE=2496,SCI_GETHOTSPOTSINGLELINE=2497,SCI_GETHSCROLLBAR=2131,SCI_GETIDENTIFIER=2623,SCI_GETINDENT=2123,SCI_GETINDENTATIONGUIDES=2133,SCI_GETINDICATORCURRENT=2501,SCI_GETINDICATORVALUE=2503,SCI_GETKEYSUNICODE=2522,SCI_GETLAYOUTCACHE=2273,SCI_GETLENGTH=2006,SCI_GETLEXER=4002,SCI_GETLINECOUNT=2154,SCI_GETLINEENDPOSITION=2136,SCI_GETLINEINDENTATION=2127,SCI_GETLINEINDENTPOSITION=2128,SCI_GETLINESTATE=2093,SCI_GETLINEVISIBLE=2228,SCI_GETMAINSELECTION=2575,SCI_GETMARGINCURSORN=2249,SCI_GETMARGINLEFT=2156,SCI_GETMARGINMASKN=2245,SCI_GETMARGINOPTIONS=2557,SCI_GETMARGINRIGHT=2158,SCI_GETMARGINSENSITIVEN=2247,SCI_GETMARGINTYPEN=2241,SCI_GETMARGINWIDTHN=2243,SCI_GETMAXLINESTATE=2094,SCI_GETMODEVENTMASK=2378,SCI_GETMODIFY=2159,SCI_GETMOUSEDOWNCAPTURES=2385,SCI_GETMOUSEDWELLTIME=2265,SCI_GETMULTIPASTE=2615,SCI_GETMULTIPLESELECTION=2564,SCI_GETOVERTYPE=2187,SCI_GETPASTECONVERTENDINGS=2468,SCI_GETPOSITIONCACHE=2515,SCI_GETPRINTCOLOURMODE=2149,SCI_GETPRINTMAGNIFICATION=2147,SCI_GETPRINTWRAPMODE=2407,SCI_GETPROPERTYINT=4010,SCI_GETREADONLY=2140,SCI_GETRECTANGULARSELECTIONANCHOR=2591,SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE=2595,SCI_GETRECTANGULARSELECTIONCARET=2589,SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE=2593,SCI_GETRECTANGULARSELECTIONMODIFIER=2599,SCI_GETSCROLLWIDTH=2275,SCI_GETSCROLLWIDTHTRACKING=2517,SCI_GETSEARCHFLAGS=2199,SCI_GETSELALPHA=2477,SCI_GETSELECTIONEND=2145,SCI_GETSELECTIONMODE=2423,SCI_GETSELECTIONNANCHOR=2579,SCI_GETSELECTIONNANCHORVIRTUALSPACE=2583,SCI_GETSELECTIONNCARET=2577,SCI_GETSELECTIONNCARETVIRTUALSPACE=2581,SCI_GETSELECTIONNEND=2587,SCI_GETSELECTIONNSTART=2585,SCI_GETSELECTIONS=2570,SCI_GETSELECTIONSTART=2143,SCI_GETSELEOLFILLED=2479,SCI_GETSTATUS=2383,SCI_GETSTYLEAT=2010,SCI_GETSTYLEBITS=2091,SCI_GETSTYLEBITSNEEDED=4011,SCI_GETTABINDENTS=2261,SCI_GETTABWIDTH=2121,SCI_GETTARGETEND=2193,SCI_GETTARGETSTART=2191,SCI_GETTECHNOLOGY=2631,SCI_GETTEXTLENGTH=2183,SCI_GETTWOPHASEDRAW=2283,SCI_GETUNDOCOLLECTION=2019,SCI_GETUSETABS=2125,SCI_GETVIEWEOL=2355,SCI_GETVIEWWS=2020,SCI_GETVIRTUALSPACEOPTIONS=2597,SCI_GETVSCROLLBAR=2281,SCI_GETWHITESPACESIZE=2087,SCI_GETWRAPINDENTMODE=2473,SCI_GETWRAPMODE=2269,SCI_GETWRAPSTARTINDENT=2465,SCI_GETWRAPVISUALFLAGS=2461,SCI_GETWRAPVISUALFLAGSLOCATION=2463,SCI_GETXOFFSET=2398,SCI_GETZOOM=2374,SCI_INDICGETALPHA=2524,SCI_INDICGETFORE=2083,SCI_INDICGETOUTLINEALPHA=2559,SCI_INDICGETSTYLE=2081,SCI_INDICGETUNDER=2511,SCI_INDICSETALPHA=2523,SCI_INDICSETFORE=2082,SCI_INDICSETOUTLINEALPHA=2558,SCI_INDICSETSTYLE=2080,SCI_INDICSETUNDER=2510,SCI_LEXER_START=4000,SCI_LINESONSCREEN=2370,SCI_MARGINGETSTYLE=2533,SCI_MARGINGETSTYLEOFFSET=2538,SCI_MARGINSETSTYLE=2532,SCI_MARGINSETSTYLEOFFSET=2537,SCI_OPTIONAL_START=3000,SCI_RGBAIMAGESETHEIGHT=2625,SCI_RGBAIMAGESETWIDTH=2624,SCI_SELECTIONISRECTANGLE=2372,SCI_SETADDITIONALCARETFORE=2604,SCI_SETADDITIONALCARETSBLINK=2567,SCI_SETADDITIONALCARETSVISIBLE=2608,SCI_SETADDITIONALSELALPHA=2602,SCI_SETADDITIONALSELBACK=2601,SCI_SETADDITIONALSELECTIONTYPING=2565,SCI_SETADDITIONALSELFORE=2600,SCI_SETANCHOR=2026,SCI_SETBACKSPACEUNINDENTS=2262,SCI_SETBUFFEREDDRAW=2035,SCI_SETCARETFORE=2069,SCI_SETCARETLINEBACK=2098,SCI_SETCARETLINEBACKALPHA=2470,SCI_SETCARETLINEVISIBLE=2096,SCI_SETCARETPERIOD=2076,SCI_SETCARETSTICKY=2458,SCI_SETCARETSTYLE=2512,SCI_SETCARETWIDTH=2188,SCI_SETCODEPAGE=2037,SCI_SETCONTROLCHARSYMBOL=2388,SCI_SETCURRENTPOS=2141,SCI_SETCURSOR=2386,SCI_SETDOCPOINTER=2358,SCI_SETEDGECOLOUR=2365,SCI_SETEDGECOLUMN=2361,SCI_SETEDGEMODE=2363,SCI_SETENDATLASTLINE=2277,SCI_SETEOLMODE=2031,SCI_SETEXTRAASCENT=2525,SCI_SETEXTRADESCENT=2527,SCI_SETFIRSTVISIBLELINE=2613,SCI_SETFOCUS=2380,SCI_SETFOLDEXPANDED=2229,SCI_SETFOLDLEVEL=2222,SCI_SETFONTQUALITY=2611,SCI_SETHIGHLIGHTGUIDE=2134,SCI_SETHOTSPOTACTIVEUNDERLINE=2412,SCI_SETHOTSPOTSINGLELINE=2421,SCI_SETHSCROLLBAR=2130,SCI_SETIDENTIFIER=2622,SCI_SETINDENT=2122,SCI_SETINDENTATIONGUIDES=2132,SCI_SETINDICATORCURRENT=2500,SCI_SETINDICATORVALUE=2502,SCI_SETKEYSUNICODE=2521,SCI_SETKEYWORDS=4005,SCI_SETLAYOUTCACHE=2272,SCI_SETLEXER=4001,SCI_SETLINEINDENTATION=2126,SCI_SETLINESTATE=2092,SCI_SETMAINSELECTION=2574,SCI_SETMARGINCURSORN=2248,SCI_SETMARGINLEFT=2155,SCI_SETMARGINMASKN=2244,SCI_SETMARGINOPTIONS=2539,SCI_SETMARGINRIGHT=2157,SCI_SETMARGINSENSITIVEN=2246,SCI_SETMARGINTYPEN=2240,SCI_SETMARGINWIDTHN=2242,SCI_SETMODEVENTMASK=2359,SCI_SETMOUSEDOWNCAPTURES=2384,SCI_SETMOUSEDWELLTIME=2264,SCI_SETMULTIPASTE=2614,SCI_SETMULTIPLESELECTION=2563,SCI_SETOVERTYPE=2186,SCI_SETPASTECONVERTENDINGS=2467,SCI_SETPOSITIONCACHE=2514,SCI_SETPRINTCOLOURMODE=2148,SCI_SETPRINTMAGNIFICATION=2146,SCI_SETPRINTWRAPMODE=2406,SCI_SETPROPERTY=4004,SCI_SETREADONLY=2171,SCI_SETRECTANGULARSELECTIONANCHOR=2590,SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE=2594,SCI_SETRECTANGULARSELECTIONCARET=2588,SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE=2592,SCI_SETRECTANGULARSELECTIONMODIFIER=2598,SCI_SETSCROLLWIDTH=2274,SCI_SETSCROLLWIDTHTRACKING=2516,SCI_SETSEARCHFLAGS=2198,SCI_SETSELALPHA=2478,SCI_SETSELECTIONEND=2144,SCI_SETSELECTIONMODE=2422,SCI_SETSELECTIONNANCHOR=2578,SCI_SETSELECTIONNANCHORVIRTUALSPACE=2582,SCI_SETSELECTIONNCARET=2576,SCI_SETSELECTIONNCARETVIRTUALSPACE=2580,SCI_SETSELECTIONNEND=2586,SCI_SETSELECTIONNSTART=2584,SCI_SETSELECTIONSTART=2142,SCI_SETSELEOLFILLED=2480,SCI_SETSTATUS=2382,SCI_SETSTYLEBITS=2090,SCI_SETTABINDENTS=2260,SCI_SETTABWIDTH=2036,SCI_SETTARGETEND=2192,SCI_SETTARGETSTART=2190,SCI_SETTECHNOLOGY=2630,SCI_SETTWOPHASEDRAW=2284,SCI_SETUNDOCOLLECTION=2012,SCI_SETUSETABS=2124,SCI_SETVIEWEOL=2356,SCI_SETVIEWWS=2021,SCI_SETVIRTUALSPACEOPTIONS=2596,SCI_SETVSCROLLBAR=2280,SCI_SETWHITESPACECHARS=2443,SCI_SETWHITESPACESIZE=2086,SCI_SETWORDCHARS=2077,SCI_SETWRAPINDENTMODE=2472,SCI_SETWRAPMODE=2268,SCI_SETWRAPSTARTINDENT=2464,SCI_SETWRAPVISUALFLAGS=2460,SCI_SETWRAPVISUALFLAGSLOCATION=2462,SCI_SETXOFFSET=2397,SCI_SETZOOM=2373,SCI_START=2000,SCI_STYLEGETBACK=2482,SCI_STYLEGETBOLD=2483,SCI_STYLEGETCASE=2489,SCI_STYLEGETCHANGEABLE=2492,SCI_STYLEGETCHARACTERSET=2490,SCI_STYLEGETEOLFILLED=2487,SCI_STYLEGETFORE=2481,SCI_STYLEGETHOTSPOT=2493,SCI_STYLEGETITALIC=2484,SCI_STYLEGETSIZE=2485,SCI_STYLEGETSIZEFRACTIONAL=2062,SCI_STYLEGETUNDERLINE=2488,SCI_STYLEGETVISIBLE=2491,SCI_STYLEGETWEIGHT=2064,SCI_STYLESETBACK=2052,SCI_STYLESETBOLD=2053,SCI_STYLESETCASE=2060,SCI_STYLESETCHANGEABLE=2099,SCI_STYLESETCHARACTERSET=2066,SCI_STYLESETEOLFILLED=2057,SCI_STYLESETFONT=2056,SCI_STYLESETFORE=2051,SCI_STYLESETHOTSPOT=2409,SCI_STYLESETITALIC=2054,SCI_STYLESETSIZE=2055,SCI_STYLESETSIZEFRACTIONAL=2061,SCI_STYLESETUNDERLINE=2059,SCI_STYLESETVISIBLE=2074,SCI_STYLESETWEIGHT=2063,SCK_ADD=310,SCK_BACK=8,SCK_DELETE=308,SCK_DIVIDE=312,SCK_DOWN=300,SCK_END=305,SCK_ESCAPE=7,SCK_HOME=304,SCK_INSERT=309,SCK_LEFT=302,SCK_MENU=315,SCK_NEXT=307,SCK_PRIOR=306,SCK_RETURN=13,SCK_RIGHT=303,SCK_RWIN=314,SCK_SUBTRACT=311,SCK_TAB=9,SCK_UP=301,SCK_WIN=313,SCMOD_ALT=4,SCMOD_CTRL=2,SCMOD_META=16,SCMOD_NORM=0,SCMOD_SHIFT=1,SCMOD_SUPER=8,SCVS_NONE=0,SCVS_RECTANGULARSELECTION=1,SCVS_USERACCESSIBLE=2,SCWS_INVISIBLE=0,SCWS_VISIBLEAFTERINDENT=2,SCWS_VISIBLEALWAYS=1,SC_ALPHA_NOALPHA=256,SC_ALPHA_OPAQUE=255,SC_ALPHA_TRANSPARENT=0,SC_CACHE_CARET=1,SC_CACHE_DOCUMENT=3,SC_CACHE_NONE=0,SC_CACHE_PAGE=2,SC_CARETSTICKY_OFF=0,SC_CARETSTICKY_ON=1,SC_CARETSTICKY_WHITESPACE=2,SC_CASE_LOWER=2,SC_CASE_MIXED=0,SC_CASE_UPPER=1,SC_CHARSET_8859_15=1000,SC_CHARSET_ANSI=0,SC_CHARSET_ARABIC=178,SC_CHARSET_BALTIC=186,SC_CHARSET_CHINESEBIG5=136,SC_CHARSET_CYRILLIC=1251,SC_CHARSET_DEFAULT=1,SC_CHARSET_EASTEUROPE=238,SC_CHARSET_GB2312=134,SC_CHARSET_GREEK=161,SC_CHARSET_HANGUL=129,SC_CHARSET_HEBREW=177,SC_CHARSET_JOHAB=130,SC_CHARSET_MAC=77,SC_CHARSET_OEM=255,SC_CHARSET_RUSSIAN=204,SC_CHARSET_SHIFTJIS=128,SC_CHARSET_SYMBOL=2,SC_CHARSET_THAI=222,SC_CHARSET_TURKISH=162,SC_CHARSET_VIETNAMESE=163,SC_CP_UTF8=65001,SC_CURSORARROW=2,SC_CURSORNORMAL=-1,SC_CURSORREVERSEARROW=7,SC_CURSORWAIT=4,SC_EFF_QUALITY_ANTIALIASED=2,SC_EFF_QUALITY_DEFAULT=0,SC_EFF_QUALITY_LCD_OPTIMIZED=3,SC_EFF_QUALITY_MASK=0xF,SC_EFF_QUALITY_NON_ANTIALIASED=1,SC_EOL_CR=1,SC_EOL_CRLF=0,SC_EOL_LF=2,SC_FOLDFLAG_LEVELNUMBERS=0x0040,SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010,SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008,SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004,SC_FOLDFLAG_LINEBEFORE_EXPANDED=0x0002,SC_FOLDLEVELBASE=0x400,SC_FOLDLEVELHEADERFLAG=0x2000,SC_FOLDLEVELNUMBERMASK=0x0FFF,SC_FOLDLEVELWHITEFLAG=0x1000,SC_FONT_SIZE_MULTIPLIER=100,SC_IV_LOOKBOTH=3,SC_IV_LOOKFORWARD=2,SC_IV_NONE=0,SC_IV_REAL=1,SC_LASTSTEPINUNDOREDO=0x100,SC_MARGINOPTION_NONE=0,SC_MARGINOPTION_SUBLINESELECT=1,SC_MARGIN_BACK=2,SC_MARGIN_FORE=3,SC_MARGIN_NUMBER=1,SC_MARGIN_RTEXT=5,SC_MARGIN_SYMBOL=0,SC_MARGIN_TEXT=4,SC_MARKNUM_FOLDER=30,SC_MARKNUM_FOLDEREND=25,SC_MARKNUM_FOLDERMIDTAIL=27,SC_MARKNUM_FOLDEROPEN=31,SC_MARKNUM_FOLDEROPENMID=26,SC_MARKNUM_FOLDERSUB=29,SC_MARKNUM_FOLDERTAIL=28,SC_MARK_ARROW=2,SC_MARK_ARROWDOWN=6,SC_MARK_ARROWS=24,SC_MARK_AVAILABLE=28,SC_MARK_BACKGROUND=22,SC_MARK_BOXMINUS=14,SC_MARK_BOXMINUSCONNECTED=15,SC_MARK_BOXPLUS=12,SC_MARK_BOXPLUSCONNECTED=13,SC_MARK_CHARACTER=10000,SC_MARK_CIRCLE=0,SC_MARK_CIRCLEMINUS=20,SC_MARK_CIRCLEMINUSCONNECTED=21,SC_MARK_CIRCLEPLUS=18,SC_MARK_CIRCLEPLUSCONNECTED=19,SC_MARK_DOTDOTDOT=23,SC_MARK_EMPTY=5,SC_MARK_FULLRECT=26,SC_MARK_LCORNER=10,SC_MARK_LCORNERCURVE=16,SC_MARK_LEFTRECT=27,SC_MARK_MINUS=7,SC_MARK_PIXMAP=25,SC_MARK_PLUS=8,SC_MARK_RGBAIMAGE=30,SC_MARK_ROUNDRECT=1,SC_MARK_SHORTARROW=4,SC_MARK_SMALLRECT=3,SC_MARK_TCORNER=11,SC_MARK_TCORNERCURVE=17,SC_MARK_UNDERLINE=29,SC_MARK_VLINE=9,SC_MASK_FOLDERS=-33554432,SC_MODEVENTMASKALL=0xFFFFF,SC_MOD_BEFOREDELETE=0x800,SC_MOD_BEFOREINSERT=0x400,SC_MOD_CHANGEANNOTATION=0x20000,SC_MOD_CHANGEFOLD=0x8,SC_MOD_CHANGEINDICATOR=0x4000,SC_MOD_CHANGELINESTATE=0x8000,SC_MOD_CHANGEMARGIN=0x10000,SC_MOD_CHANGEMARKER=0x200,SC_MOD_CHANGESTYLE=0x4,SC_MOD_CONTAINER=0x40000,SC_MOD_DELETETEXT=0x2,SC_MOD_INSERTTEXT=0x1,SC_MOD_LEXERSTATE=0x80000,SC_MULTILINEUNDOREDO=0x1000,SC_MULTIPASTE_EACH=1,SC_MULTIPASTE_ONCE=0,SC_MULTISTEPUNDOREDO=0x80,SC_PERFORMED_REDO=0x40,SC_PERFORMED_UNDO=0x20,SC_PERFORMED_USER=0x10,SC_PRINT_BLACKONWHITE=2,SC_PRINT_COLOURONWHITE=3,SC_PRINT_COLOURONWHITEDEFAULTBG=4,SC_PRINT_INVERTLIGHT=1,SC_PRINT_NORMAL=0,SC_SEL_LINES=2,SC_SEL_RECTANGLE=1,SC_SEL_STREAM=0,SC_SEL_THIN=3,SC_STARTACTION=0x2000,SC_STATUS_BADALLOC=2,SC_STATUS_FAILURE=1,SC_STATUS_OK=0,SC_TECHNOLOGY_DEFAULT=0,SC_TECHNOLOGY_DIRECTWRITE=1,SC_TIME_FOREVER=10000000,SC_TYPE_BOOLEAN=0,SC_TYPE_INTEGER=1,SC_TYPE_STRING=2,SC_UPDATE_CONTENT=0x1,SC_UPDATE_H_SCROLL=0x8,SC_UPDATE_SELECTION=0x2,SC_UPDATE_V_SCROLL=0x4,SC_WEIGHT_BOLD=700,SC_WEIGHT_NORMAL=400,SC_WEIGHT_SEMIBOLD=600,SC_WRAPINDENT_FIXED=0,SC_WRAPINDENT_INDENT=2,SC_WRAPINDENT_SAME=1,SC_WRAPVISUALFLAGLOC_DEFAULT=0x0000,SC_WRAPVISUALFLAGLOC_END_BY_TEXT=0x0001,SC_WRAPVISUALFLAGLOC_START_BY_TEXT=0x0002,SC_WRAPVISUALFLAG_END=0x0001,SC_WRAPVISUALFLAG_NONE=0x0000,SC_WRAPVISUALFLAG_START=0x0002,SC_WRAP_CHAR=2,SC_WRAP_NONE=0,SC_WRAP_WORD=1,STYLE_BRACEBAD=35,STYLE_BRACELIGHT=34,STYLE_CALLTIP=38,STYLE_CONTROLCHAR=36,STYLE_DEFAULT=32,STYLE_INDENTGUIDE=37,STYLE_LASTPREDEFINED=39,STYLE_LINENUMBER=33,STYLE_MAX=255,UNDO_MAY_COALESCE=1,VISIBLE_SLOP=0x01,VISIBLE_STRICT=0x04,SCN_DOUBLECLICK=2006,SCN_AUTOCCHARDELETED=2027,SCN_SAVEPOINTLEFT=2003,SCN_PAINTED=2013,SCN_HOTSPOTRELEASECLICK=2028,SCN_UPDATEUI=2007,SCN_STYLENEEDED=2000,SCN_AUTOCCANCELLED=2026,SCN_MACRORECORD=2009,SCN_INDICATORRELEASE=2024,SCN_MODIFIED=2008,SCN_SAVEPOINTREACHED=2002,SCN_HOTSPOTDOUBLECLICK=2020,SCN_NEEDSHOWN=2011,SCN_CALLTIPCLICK=2021,SCN_AUTOCSELECTION=2022,SCN_DWELLEND=2017,SCN_ZOOM=2018,SCN_CHARADDED=2001,SCN_HOTSPOTCLICK=2019,SCN_KEY=2005,SCN_DWELLSTART=2016,SCN_MARGINCLICK=2010,SCN_USERLISTSELECTION=2014,SCN_URIDROPPED=2015,SCN_INDICATORCLICK=2023,SCN_MODIFYATTEMPTRO=2004,SCLEX_CONTAINER=0,SCLEX_AUTOMATIC=1000,SCLEX_LPEG=999,SCLEX_NULL=1}
+M.constants = {ANNOTATION_BOXED=2,ANNOTATION_HIDDEN=0,ANNOTATION_STANDARD=1,CARETSTYLE_BLOCK=2,CARETSTYLE_INVISIBLE=0,CARETSTYLE_LINE=1,CARET_EVEN=0x08,CARET_JUMPS=0x10,CARET_SLOP=0x01,CARET_STRICT=0x04,EDGE_BACKGROUND=2,EDGE_LINE=1,EDGE_NONE=0,INDIC0_MASK=0x20,INDIC1_MASK=0x40,INDIC2_MASK=0x80,INDICS_MASK=0xE0,INDIC_BOX=6,INDIC_CONTAINER=8,INDIC_DASH=9,INDIC_DIAGONAL=3,INDIC_DOTBOX=12,INDIC_DOTS=10,INDIC_HIDDEN=5,INDIC_MAX=31,INDIC_PLAIN=0,INDIC_ROUNDBOX=7,INDIC_SQUIGGLE=1,INDIC_SQUIGGLELOW=11,INDIC_STRAIGHTBOX=8,INDIC_STRIKE=4,INDIC_TT=2,INVALID_POSITION=-1,KEYWORDSET_MAX=8,MARKER_MAX=31,SCEN_CHANGE=768,SCEN_KILLFOCUS=256,SCEN_SETFOCUS=512,SCFIND_MATCHCASE=4,SCFIND_POSIX=0x00400000,SCFIND_REGEXP=0x00200000,SCFIND_WHOLEWORD=2,SCFIND_WORDSTART=0x00100000,SCI_ANNOTATIONGETLINES=2546,SCI_ANNOTATIONGETSTYLE=2543,SCI_ANNOTATIONGETSTYLEOFFSET=2551,SCI_ANNOTATIONGETVISIBLE=2549,SCI_ANNOTATIONSETSTYLE=2542,SCI_ANNOTATIONSETSTYLEOFFSET=2550,SCI_ANNOTATIONSETVISIBLE=2548,SCI_AUTOCGETAUTOHIDE=2119,SCI_AUTOCGETCANCELATSTART=2111,SCI_AUTOCGETCHOOSESINGLE=2114,SCI_AUTOCGETDROPRESTOFWORD=2271,SCI_AUTOCGETIGNORECASE=2116,SCI_AUTOCGETMAXHEIGHT=2211,SCI_AUTOCGETMAXWIDTH=2209,SCI_AUTOCGETSEPARATOR=2107,SCI_AUTOCGETTYPESEPARATOR=2285,SCI_AUTOCSETAUTOHIDE=2118,SCI_AUTOCSETCANCELATSTART=2110,SCI_AUTOCSETCHOOSESINGLE=2113,SCI_AUTOCSETDROPRESTOFWORD=2270,SCI_AUTOCSETFILLUPS=2112,SCI_AUTOCSETIGNORECASE=2115,SCI_AUTOCSETMAXHEIGHT=2210,SCI_AUTOCSETMAXWIDTH=2208,SCI_AUTOCSETSEPARATOR=2106,SCI_AUTOCSETTYPESEPARATOR=2286,SCI_CALLTIPSETBACK=2205,SCI_CALLTIPSETFORE=2206,SCI_CALLTIPSETFOREHLT=2207,SCI_CALLTIPSETPOSITION=2213,SCI_CALLTIPUSESTYLE=2212,SCI_GETADDITIONALCARETFORE=2605,SCI_GETADDITIONALCARETSBLINK=2568,SCI_GETADDITIONALCARETSVISIBLE=2609,SCI_GETADDITIONALSELALPHA=2603,SCI_GETADDITIONALSELECTIONTYPING=2566,SCI_GETALLLINESVISIBLE=2236,SCI_GETANCHOR=2009,SCI_GETBACKSPACEUNINDENTS=2263,SCI_GETBUFFEREDDRAW=2034,SCI_GETCARETFORE=2138,SCI_GETCARETLINEBACK=2097,SCI_GETCARETLINEBACKALPHA=2471,SCI_GETCARETLINEVISIBLE=2095,SCI_GETCARETPERIOD=2075,SCI_GETCARETSTICKY=2457,SCI_GETCARETSTYLE=2513,SCI_GETCARETWIDTH=2189,SCI_GETCHARACTERPOINTER=2520,SCI_GETCHARAT=2007,SCI_GETCODEPAGE=2137,SCI_GETCOLUMN=2129,SCI_GETCONTROLCHARSYMBOL=2389,SCI_GETCURRENTPOS=2008,SCI_GETCURSOR=2387,SCI_GETDIRECTFUNCTION=2184,SCI_GETDIRECTPOINTER=2185,SCI_GETDOCPOINTER=2357,SCI_GETEDGECOLOUR=2364,SCI_GETEDGECOLUMN=2360,SCI_GETEDGEMODE=2362,SCI_GETENDATLASTLINE=2278,SCI_GETENDSTYLED=2028,SCI_GETEOLMODE=2030,SCI_GETEXTRAASCENT=2526,SCI_GETEXTRADESCENT=2528,SCI_GETFIRSTVISIBLELINE=2152,SCI_GETFOCUS=2381,SCI_GETFOLDEXPANDED=2230,SCI_GETFOLDLEVEL=2223,SCI_GETFOLDPARENT=2225,SCI_GETFONTQUALITY=2612,SCI_GETHIGHLIGHTGUIDE=2135,SCI_GETHOTSPOTACTIVEUNDERLINE=2496,SCI_GETHOTSPOTSINGLELINE=2497,SCI_GETHSCROLLBAR=2131,SCI_GETIDENTIFIER=2623,SCI_GETINDENT=2123,SCI_GETINDENTATIONGUIDES=2133,SCI_GETINDICATORCURRENT=2501,SCI_GETINDICATORVALUE=2503,SCI_GETKEYSUNICODE=2522,SCI_GETLAYOUTCACHE=2273,SCI_GETLENGTH=2006,SCI_GETLEXER=4002,SCI_GETLINECOUNT=2154,SCI_GETLINEENDPOSITION=2136,SCI_GETLINEINDENTATION=2127,SCI_GETLINEINDENTPOSITION=2128,SCI_GETLINESTATE=2093,SCI_GETLINEVISIBLE=2228,SCI_GETMAINSELECTION=2575,SCI_GETMARGINCURSORN=2249,SCI_GETMARGINLEFT=2156,SCI_GETMARGINMASKN=2245,SCI_GETMARGINOPTIONS=2557,SCI_GETMARGINRIGHT=2158,SCI_GETMARGINSENSITIVEN=2247,SCI_GETMARGINTYPEN=2241,SCI_GETMARGINWIDTHN=2243,SCI_GETMAXLINESTATE=2094,SCI_GETMODEVENTMASK=2378,SCI_GETMODIFY=2159,SCI_GETMOUSEDOWNCAPTURES=2385,SCI_GETMOUSEDWELLTIME=2265,SCI_GETMULTIPASTE=2615,SCI_GETMULTIPLESELECTION=2564,SCI_GETOVERTYPE=2187,SCI_GETPASTECONVERTENDINGS=2468,SCI_GETPOSITIONCACHE=2515,SCI_GETPRINTCOLOURMODE=2149,SCI_GETPRINTMAGNIFICATION=2147,SCI_GETPRINTWRAPMODE=2407,SCI_GETPROPERTYINT=4010,SCI_GETREADONLY=2140,SCI_GETRECTANGULARSELECTIONANCHOR=2591,SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE=2595,SCI_GETRECTANGULARSELECTIONCARET=2589,SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE=2593,SCI_GETRECTANGULARSELECTIONMODIFIER=2599,SCI_GETSCROLLWIDTH=2275,SCI_GETSCROLLWIDTHTRACKING=2517,SCI_GETSEARCHFLAGS=2199,SCI_GETSELALPHA=2477,SCI_GETSELECTIONEND=2145,SCI_GETSELECTIONMODE=2423,SCI_GETSELECTIONNANCHOR=2579,SCI_GETSELECTIONNANCHORVIRTUALSPACE=2583,SCI_GETSELECTIONNCARET=2577,SCI_GETSELECTIONNCARETVIRTUALSPACE=2581,SCI_GETSELECTIONNEND=2587,SCI_GETSELECTIONNSTART=2585,SCI_GETSELECTIONS=2570,SCI_GETSELECTIONSTART=2143,SCI_GETSELEOLFILLED=2479,SCI_GETSTATUS=2383,SCI_GETSTYLEAT=2010,SCI_GETSTYLEBITS=2091,SCI_GETSTYLEBITSNEEDED=4011,SCI_GETTABINDENTS=2261,SCI_GETTABWIDTH=2121,SCI_GETTARGETEND=2193,SCI_GETTARGETSTART=2191,SCI_GETTECHNOLOGY=2631,SCI_GETTEXTLENGTH=2183,SCI_GETTWOPHASEDRAW=2283,SCI_GETUNDOCOLLECTION=2019,SCI_GETUSETABS=2125,SCI_GETVIEWEOL=2355,SCI_GETVIEWWS=2020,SCI_GETVIRTUALSPACEOPTIONS=2597,SCI_GETVSCROLLBAR=2281,SCI_GETWHITESPACESIZE=2087,SCI_GETWRAPINDENTMODE=2473,SCI_GETWRAPMODE=2269,SCI_GETWRAPSTARTINDENT=2465,SCI_GETWRAPVISUALFLAGS=2461,SCI_GETWRAPVISUALFLAGSLOCATION=2463,SCI_GETXOFFSET=2398,SCI_GETZOOM=2374,SCI_INDICGETALPHA=2524,SCI_INDICGETFORE=2083,SCI_INDICGETOUTLINEALPHA=2559,SCI_INDICGETSTYLE=2081,SCI_INDICGETUNDER=2511,SCI_INDICSETALPHA=2523,SCI_INDICSETFORE=2082,SCI_INDICSETOUTLINEALPHA=2558,SCI_INDICSETSTYLE=2080,SCI_INDICSETUNDER=2510,SCI_LEXER_START=4000,SCI_LINESONSCREEN=2370,SCI_MARGINGETSTYLE=2533,SCI_MARGINGETSTYLEOFFSET=2538,SCI_MARGINSETSTYLE=2532,SCI_MARGINSETSTYLEOFFSET=2537,SCI_OPTIONAL_START=3000,SCI_RGBAIMAGESETHEIGHT=2625,SCI_RGBAIMAGESETWIDTH=2624,SCI_SELECTIONISRECTANGLE=2372,SCI_SETADDITIONALCARETFORE=2604,SCI_SETADDITIONALCARETSBLINK=2567,SCI_SETADDITIONALCARETSVISIBLE=2608,SCI_SETADDITIONALSELALPHA=2602,SCI_SETADDITIONALSELBACK=2601,SCI_SETADDITIONALSELECTIONTYPING=2565,SCI_SETADDITIONALSELFORE=2600,SCI_SETANCHOR=2026,SCI_SETBACKSPACEUNINDENTS=2262,SCI_SETBUFFEREDDRAW=2035,SCI_SETCARETFORE=2069,SCI_SETCARETLINEBACK=2098,SCI_SETCARETLINEBACKALPHA=2470,SCI_SETCARETLINEVISIBLE=2096,SCI_SETCARETPERIOD=2076,SCI_SETCARETSTICKY=2458,SCI_SETCARETSTYLE=2512,SCI_SETCARETWIDTH=2188,SCI_SETCODEPAGE=2037,SCI_SETCONTROLCHARSYMBOL=2388,SCI_SETCURRENTPOS=2141,SCI_SETCURSOR=2386,SCI_SETDOCPOINTER=2358,SCI_SETEDGECOLOUR=2365,SCI_SETEDGECOLUMN=2361,SCI_SETEDGEMODE=2363,SCI_SETENDATLASTLINE=2277,SCI_SETEOLMODE=2031,SCI_SETEXTRAASCENT=2525,SCI_SETEXTRADESCENT=2527,SCI_SETFIRSTVISIBLELINE=2613,SCI_SETFOCUS=2380,SCI_SETFOLDEXPANDED=2229,SCI_SETFOLDLEVEL=2222,SCI_SETFONTQUALITY=2611,SCI_SETHIGHLIGHTGUIDE=2134,SCI_SETHOTSPOTACTIVEUNDERLINE=2412,SCI_SETHOTSPOTSINGLELINE=2421,SCI_SETHSCROLLBAR=2130,SCI_SETIDENTIFIER=2622,SCI_SETINDENT=2122,SCI_SETINDENTATIONGUIDES=2132,SCI_SETINDICATORCURRENT=2500,SCI_SETINDICATORVALUE=2502,SCI_SETKEYSUNICODE=2521,SCI_SETKEYWORDS=4005,SCI_SETLAYOUTCACHE=2272,SCI_SETLEXER=4001,SCI_SETLINEINDENTATION=2126,SCI_SETLINESTATE=2092,SCI_SETMAINSELECTION=2574,SCI_SETMARGINCURSORN=2248,SCI_SETMARGINLEFT=2155,SCI_SETMARGINMASKN=2244,SCI_SETMARGINOPTIONS=2539,SCI_SETMARGINRIGHT=2157,SCI_SETMARGINSENSITIVEN=2246,SCI_SETMARGINTYPEN=2240,SCI_SETMARGINWIDTHN=2242,SCI_SETMODEVENTMASK=2359,SCI_SETMOUSEDOWNCAPTURES=2384,SCI_SETMOUSEDWELLTIME=2264,SCI_SETMULTIPASTE=2614,SCI_SETMULTIPLESELECTION=2563,SCI_SETOVERTYPE=2186,SCI_SETPASTECONVERTENDINGS=2467,SCI_SETPOSITIONCACHE=2514,SCI_SETPRINTCOLOURMODE=2148,SCI_SETPRINTMAGNIFICATION=2146,SCI_SETPRINTWRAPMODE=2406,SCI_SETPROPERTY=4004,SCI_SETREADONLY=2171,SCI_SETRECTANGULARSELECTIONANCHOR=2590,SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE=2594,SCI_SETRECTANGULARSELECTIONCARET=2588,SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE=2592,SCI_SETRECTANGULARSELECTIONMODIFIER=2598,SCI_SETSCROLLWIDTH=2274,SCI_SETSCROLLWIDTHTRACKING=2516,SCI_SETSEARCHFLAGS=2198,SCI_SETSELALPHA=2478,SCI_SETSELECTIONEND=2144,SCI_SETSELECTIONMODE=2422,SCI_SETSELECTIONNANCHOR=2578,SCI_SETSELECTIONNANCHORVIRTUALSPACE=2582,SCI_SETSELECTIONNCARET=2576,SCI_SETSELECTIONNCARETVIRTUALSPACE=2580,SCI_SETSELECTIONNEND=2586,SCI_SETSELECTIONNSTART=2584,SCI_SETSELECTIONSTART=2142,SCI_SETSELEOLFILLED=2480,SCI_SETSTATUS=2382,SCI_SETSTYLEBITS=2090,SCI_SETTABINDENTS=2260,SCI_SETTABWIDTH=2036,SCI_SETTARGETEND=2192,SCI_SETTARGETSTART=2190,SCI_SETTECHNOLOGY=2630,SCI_SETTWOPHASEDRAW=2284,SCI_SETUNDOCOLLECTION=2012,SCI_SETUSETABS=2124,SCI_SETVIEWEOL=2356,SCI_SETVIEWWS=2021,SCI_SETVIRTUALSPACEOPTIONS=2596,SCI_SETVSCROLLBAR=2280,SCI_SETWHITESPACECHARS=2443,SCI_SETWHITESPACESIZE=2086,SCI_SETWORDCHARS=2077,SCI_SETWRAPINDENTMODE=2472,SCI_SETWRAPMODE=2268,SCI_SETWRAPSTARTINDENT=2464,SCI_SETWRAPVISUALFLAGS=2460,SCI_SETWRAPVISUALFLAGSLOCATION=2462,SCI_SETXOFFSET=2397,SCI_SETZOOM=2373,SCI_START=2000,SCI_STYLEGETBACK=2482,SCI_STYLEGETBOLD=2483,SCI_STYLEGETCASE=2489,SCI_STYLEGETCHANGEABLE=2492,SCI_STYLEGETCHARACTERSET=2490,SCI_STYLEGETEOLFILLED=2487,SCI_STYLEGETFORE=2481,SCI_STYLEGETHOTSPOT=2493,SCI_STYLEGETITALIC=2484,SCI_STYLEGETSIZE=2485,SCI_STYLEGETSIZEFRACTIONAL=2062,SCI_STYLEGETUNDERLINE=2488,SCI_STYLEGETVISIBLE=2491,SCI_STYLEGETWEIGHT=2064,SCI_STYLESETBACK=2052,SCI_STYLESETBOLD=2053,SCI_STYLESETCASE=2060,SCI_STYLESETCHANGEABLE=2099,SCI_STYLESETCHARACTERSET=2066,SCI_STYLESETEOLFILLED=2057,SCI_STYLESETFONT=2056,SCI_STYLESETFORE=2051,SCI_STYLESETHOTSPOT=2409,SCI_STYLESETITALIC=2054,SCI_STYLESETSIZE=2055,SCI_STYLESETSIZEFRACTIONAL=2061,SCI_STYLESETUNDERLINE=2059,SCI_STYLESETVISIBLE=2074,SCI_STYLESETWEIGHT=2063,SCK_ADD=310,SCK_BACK=8,SCK_DELETE=308,SCK_DIVIDE=312,SCK_DOWN=300,SCK_END=305,SCK_ESCAPE=7,SCK_HOME=304,SCK_INSERT=309,SCK_LEFT=302,SCK_MENU=315,SCK_NEXT=307,SCK_PRIOR=306,SCK_RETURN=13,SCK_RIGHT=303,SCK_RWIN=314,SCK_SUBTRACT=311,SCK_TAB=9,SCK_UP=301,SCK_WIN=313,SCMOD_ALT=4,SCMOD_CTRL=2,SCMOD_META=16,SCMOD_NORM=0,SCMOD_SHIFT=1,SCMOD_SUPER=8,SCVS_NONE=0,SCVS_RECTANGULARSELECTION=1,SCVS_USERACCESSIBLE=2,SCWS_INVISIBLE=0,SCWS_VISIBLEAFTERINDENT=2,SCWS_VISIBLEALWAYS=1,SC_ALPHA_NOALPHA=256,SC_ALPHA_OPAQUE=255,SC_ALPHA_TRANSPARENT=0,SC_CACHE_CARET=1,SC_CACHE_DOCUMENT=3,SC_CACHE_NONE=0,SC_CACHE_PAGE=2,SC_CARETSTICKY_OFF=0,SC_CARETSTICKY_ON=1,SC_CARETSTICKY_WHITESPACE=2,SC_CASE_LOWER=2,SC_CASE_MIXED=0,SC_CASE_UPPER=1,SC_CHARSET_8859_15=1000,SC_CHARSET_ANSI=0,SC_CHARSET_ARABIC=178,SC_CHARSET_BALTIC=186,SC_CHARSET_CHINESEBIG5=136,SC_CHARSET_CYRILLIC=1251,SC_CHARSET_DEFAULT=1,SC_CHARSET_EASTEUROPE=238,SC_CHARSET_GB2312=134,SC_CHARSET_GREEK=161,SC_CHARSET_HANGUL=129,SC_CHARSET_HEBREW=177,SC_CHARSET_JOHAB=130,SC_CHARSET_MAC=77,SC_CHARSET_OEM=255,SC_CHARSET_RUSSIAN=204,SC_CHARSET_SHIFTJIS=128,SC_CHARSET_SYMBOL=2,SC_CHARSET_THAI=222,SC_CHARSET_TURKISH=162,SC_CHARSET_VIETNAMESE=163,SC_CP_UTF8=65001,SC_CURSORARROW=2,SC_CURSORNORMAL=-1,SC_CURSORREVERSEARROW=7,SC_CURSORWAIT=4,SC_EFF_QUALITY_ANTIALIASED=2,SC_EFF_QUALITY_DEFAULT=0,SC_EFF_QUALITY_LCD_OPTIMIZED=3,SC_EFF_QUALITY_MASK=0xF,SC_EFF_QUALITY_NON_ANTIALIASED=1,SC_EOL_CR=1,SC_EOL_CRLF=0,SC_EOL_LF=2,SC_FOLDFLAG_LEVELNUMBERS=0x0040,SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010,SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008,SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004,SC_FOLDFLAG_LINEBEFORE_EXPANDED=0x0002,SC_FOLDLEVELBASE=0x400,SC_FOLDLEVELHEADERFLAG=0x2000,SC_FOLDLEVELNUMBERMASK=0x0FFF,SC_FOLDLEVELWHITEFLAG=0x1000,SC_FONT_SIZE_MULTIPLIER=100,SC_IV_LOOKBOTH=3,SC_IV_LOOKFORWARD=2,SC_IV_NONE=0,SC_IV_REAL=1,SC_LASTSTEPINUNDOREDO=0x100,SC_MARGINOPTION_NONE=0,SC_MARGINOPTION_SUBLINESELECT=1,SC_MARGIN_BACK=2,SC_MARGIN_FORE=3,SC_MARGIN_NUMBER=1,SC_MARGIN_RTEXT=5,SC_MARGIN_SYMBOL=0,SC_MARGIN_TEXT=4,SC_MARKNUM_FOLDER=30,SC_MARKNUM_FOLDEREND=25,SC_MARKNUM_FOLDERMIDTAIL=27,SC_MARKNUM_FOLDEROPEN=31,SC_MARKNUM_FOLDEROPENMID=26,SC_MARKNUM_FOLDERSUB=29,SC_MARKNUM_FOLDERTAIL=28,SC_MARK_ARROW=2,SC_MARK_ARROWDOWN=6,SC_MARK_ARROWS=24,SC_MARK_AVAILABLE=28,SC_MARK_BACKGROUND=22,SC_MARK_BOXMINUS=14,SC_MARK_BOXMINUSCONNECTED=15,SC_MARK_BOXPLUS=12,SC_MARK_BOXPLUSCONNECTED=13,SC_MARK_CHARACTER=10000,SC_MARK_CIRCLE=0,SC_MARK_CIRCLEMINUS=20,SC_MARK_CIRCLEMINUSCONNECTED=21,SC_MARK_CIRCLEPLUS=18,SC_MARK_CIRCLEPLUSCONNECTED=19,SC_MARK_DOTDOTDOT=23,SC_MARK_EMPTY=5,SC_MARK_FULLRECT=26,SC_MARK_LCORNER=10,SC_MARK_LCORNERCURVE=16,SC_MARK_LEFTRECT=27,SC_MARK_MINUS=7,SC_MARK_PIXMAP=25,SC_MARK_PLUS=8,SC_MARK_RGBAIMAGE=30,SC_MARK_ROUNDRECT=1,SC_MARK_SHORTARROW=4,SC_MARK_SMALLRECT=3,SC_MARK_TCORNER=11,SC_MARK_TCORNERCURVE=17,SC_MARK_UNDERLINE=29,SC_MARK_VLINE=9,SC_MASK_FOLDERS=-33554432,SC_MODEVENTMASKALL=0xFFFFF,SC_MOD_BEFOREDELETE=0x800,SC_MOD_BEFOREINSERT=0x400,SC_MOD_CHANGEANNOTATION=0x20000,SC_MOD_CHANGEFOLD=0x8,SC_MOD_CHANGEINDICATOR=0x4000,SC_MOD_CHANGELINESTATE=0x8000,SC_MOD_CHANGEMARGIN=0x10000,SC_MOD_CHANGEMARKER=0x200,SC_MOD_CHANGESTYLE=0x4,SC_MOD_CONTAINER=0x40000,SC_MOD_DELETETEXT=0x2,SC_MOD_INSERTTEXT=0x1,SC_MOD_LEXERSTATE=0x80000,SC_MULTILINEUNDOREDO=0x1000,SC_MULTIPASTE_EACH=1,SC_MULTIPASTE_ONCE=0,SC_MULTISTEPUNDOREDO=0x80,SC_PERFORMED_REDO=0x40,SC_PERFORMED_UNDO=0x20,SC_PERFORMED_USER=0x10,SC_PRINT_BLACKONWHITE=2,SC_PRINT_COLOURONWHITE=3,SC_PRINT_COLOURONWHITEDEFAULTBG=4,SC_PRINT_INVERTLIGHT=1,SC_PRINT_NORMAL=0,SC_SEL_LINES=2,SC_SEL_RECTANGLE=1,SC_SEL_STREAM=0,SC_SEL_THIN=3,SC_STARTACTION=0x2000,SC_STATUS_BADALLOC=2,SC_STATUS_FAILURE=1,SC_STATUS_OK=0,SC_TECHNOLOGY_DEFAULT=0,SC_TECHNOLOGY_DIRECTWRITE=1,SC_TIME_FOREVER=10000000,SC_TYPE_BOOLEAN=0,SC_TYPE_INTEGER=1,SC_TYPE_STRING=2,SC_UPDATE_CONTENT=0x1,SC_UPDATE_H_SCROLL=0x8,SC_UPDATE_SELECTION=0x2,SC_UPDATE_V_SCROLL=0x4,SC_WEIGHT_BOLD=700,SC_WEIGHT_NORMAL=400,SC_WEIGHT_SEMIBOLD=600,SC_WRAPINDENT_FIXED=0,SC_WRAPINDENT_INDENT=2,SC_WRAPINDENT_SAME=1,SC_WRAPVISUALFLAGLOC_DEFAULT=0x0000,SC_WRAPVISUALFLAGLOC_END_BY_TEXT=0x0001,SC_WRAPVISUALFLAGLOC_START_BY_TEXT=0x0002,SC_WRAPVISUALFLAG_END=0x0001,SC_WRAPVISUALFLAG_NONE=0x0000,SC_WRAPVISUALFLAG_START=0x0002,SC_WRAP_CHAR=2,SC_WRAP_NONE=0,SC_WRAP_WORD=1,STYLE_BRACEBAD=35,STYLE_BRACELIGHT=34,STYLE_CALLTIP=38,STYLE_CONTROLCHAR=36,STYLE_DEFAULT=32,STYLE_INDENTGUIDE=37,STYLE_LASTPREDEFINED=39,STYLE_LINENUMBER=33,STYLE_MAX=255,UNDO_MAY_COALESCE=1,VISIBLE_SLOP=0x01,VISIBLE_STRICT=0x04,SCN_DOUBLECLICK=2006,SCN_AUTOCCHARDELETED=2027,SCN_SAVEPOINTLEFT=2003,SCN_PAINTED=2013,SCN_HOTSPOTRELEASECLICK=2028,SCN_UPDATEUI=2007,SCN_STYLENEEDED=2000,SCN_AUTOCCANCELLED=2026,SCN_MACRORECORD=2009,SCN_INDICATORRELEASE=2024,SCN_MODIFIED=2008,SCN_SAVEPOINTREACHED=2002,SCN_HOTSPOTDOUBLECLICK=2020,SCN_NEEDSHOWN=2011,SCN_CALLTIPCLICK=2021,SCN_AUTOCSELECTION=2022,SCN_DWELLEND=2017,SCN_ZOOM=2018,SCN_CHARADDED=2001,SCN_HOTSPOTCLICK=2019,SCN_KEY=2005,SCN_DWELLSTART=2016,SCN_MARGINCLICK=2010,SCN_USERLISTSELECTION=2014,SCN_URIDROPPED=2015,SCN_INDICATORCLICK=2023,SCN_MODIFYATTEMPTRO=2004,SCLEX_CONTAINER=0,SCLEX_AUTOMATIC=1000,SCLEX_LPEG=999,SCLEX_NULL=1}
---
-- Scintilla functions.
-- @class table
-- @name functions
-functions = {add_ref_document={2376,0,0,1},add_selection={2573,1,1,1},add_styled_text={2002,0,2,9},add_text={2001,0,2,7},add_undo_action={2560,0,1,1},allocate={2446,0,1,0},annotation_clear_all={2547,0,0,0},annotation_get_styles={2545,1,1,8},annotation_get_text={2541,1,1,8},annotation_set_styles={2544,0,1,7},annotation_set_text={2540,0,1,7},append_text={2282,0,2,7},assign_cmd_key={2070,0,6,1},auto_c_active={2102,5,0,0},auto_c_cancel={2101,0,0,0},auto_c_complete={2104,0,0,0},auto_c_get_current={2445,1,0,0},auto_c_get_current_text={2610,1,0,8},auto_c_pos_start={2103,3,0,0},auto_c_select={2108,0,0,7},auto_c_show={2100,0,1,7},auto_c_stops={2105,0,0,7},back_tab={2328,0,0,0},begin_undo_action={2078,0,0,0},brace_bad_light={2352,0,3,0},brace_bad_light_indicator={2499,0,5,1},brace_highlight={2351,0,3,3},brace_highlight_indicator={2498,0,5,1},brace_match={2353,3,3,0},call_tip_active={2202,5,0,0},call_tip_cancel={2201,0,0,0},call_tip_pos_start={2203,3,0,0},call_tip_set_hlt={2204,0,1,1},call_tip_show={2200,0,3,7},can_paste={2173,5,0,0},can_redo={2016,5,0,0},can_undo={2174,5,0,0},cancel={2325,0,0,0},change_lexer_state={2617,1,3,3},char_left={2304,0,0,0},char_left_extend={2305,0,0,0},char_left_rect_extend={2428,0,0,0},char_position_from_point={2561,3,1,1},char_position_from_point_close={2562,3,1,1},char_right={2306,0,0,0},char_right_extend={2307,0,0,0},char_right_rect_extend={2429,0,0,0},choose_caret_x={2399,0,0,0},clear={2180,0,0,0},clear_all={2004,0,0,0},clear_all_cmd_keys={2072,0,0,0},clear_cmd_key={2071,0,6,0},clear_document_style={2005,0,0,0},clear_registered_images={2408,0,0,0},clear_selections={2571,0,0,0},colourise={4003,0,3,3},contracted_fold_next={2618,1,1,0},convert_eo_ls={2029,0,1,0},copy={2178,0,0,0},copy_allow_line={2519,0,0,0},copy_range={2419,0,3,3},copy_text={2420,0,2,7},create_document={2375,1,0,0},create_loader={2632,1,1,0},cut={2177,0,0,0},del_line_left={2395,0,0,0},del_line_right={2396,0,0,0},del_word_left={2335,0,0,0},del_word_right={2336,0,0,0},del_word_right_end={2518,0,0,0},delete_back={2326,0,0,0},delete_back_not_line={2344,0,0,0},describe_key_word_sets={4017,1,0,8},describe_property={4016,1,7,8},doc_line_from_visible={2221,1,1,0},document_end={2318,0,0,0},document_end_extend={2319,0,0,0},document_start={2316,0,0,0},document_start_extend={2317,0,0,0},edit_toggle_overtype={2324,0,0,0},empty_undo_buffer={2175,0,0,0},encoded_from_utf8={2449,1,7,8},end_undo_action={2079,0,0,0},ensure_visible={2232,0,1,0},ensure_visible_enforce_policy={2234,0,1,0},find_column={2456,1,1,1},find_text={2150,3,1,11},form_feed={2330,0,0,0},format_range={2151,3,5,12},get_cur_line={2027,1,2,8},get_hotspot_active_back={2495,4,0,0},get_hotspot_active_fore={2494,4,0,0},get_last_child={2224,1,1,1},get_lexer_language={4012,1,0,8},get_line={2153,1,1,8},get_line_sel_end_position={2425,3,1,0},get_line_sel_start_position={2424,3,1,0},get_property={4008,1,7,8},get_property_expanded={4009,1,7,8},get_sel_text={2161,1,0,8},get_styled_text={2015,1,0,10},get_tag={2616,1,1,8},get_text={2182,1,2,8},get_text_range={2162,1,0,10},goto_line={2024,0,1,0},goto_pos={2025,0,3,0},grab_focus={2400,0,0,0},hide_lines={2227,0,1,1},hide_selection={2163,0,5,0},home={2312,0,0,0},home_display={2345,0,0,0},home_display_extend={2346,0,0,0},home_extend={2313,0,0,0},home_rect_extend={2430,0,0,0},home_wrap={2349,0,0,0},home_wrap_extend={2450,0,0,0},indicator_all_on_for={2506,1,1,0},indicator_clear_range={2505,0,1,1},indicator_end={2509,1,1,1},indicator_fill_range={2504,0,1,1},indicator_start={2508,1,1,1},indicator_value_at={2507,1,1,1},insert_text={2003,0,3,7},line_copy={2455,0,0,0},line_cut={2337,0,0,0},line_delete={2338,0,0,0},line_down={2300,0,0,0},line_down_extend={2301,0,0,0},line_down_rect_extend={2426,0,0,0},line_duplicate={2404,0,0,0},line_end={2314,0,0,0},line_end_display={2347,0,0,0},line_end_display_extend={2348,0,0,0},line_end_extend={2315,0,0,0},line_end_rect_extend={2432,0,0,0},line_end_wrap={2451,0,0,0},line_end_wrap_extend={2452,0,0,0},line_from_position={2166,1,3,0},line_length={2350,1,1,0},line_scroll={2168,0,1,1},line_scroll_down={2342,0,0,0},line_scroll_up={2343,0,0,0},line_transpose={2339,0,0,0},line_up={2302,0,0,0},line_up_extend={2303,0,0,0},line_up_rect_extend={2427,0,0,0},lines_join={2288,0,0,0},lines_split={2289,0,1,0},load_lexer_library={4007,0,0,7},lower_case={2340,0,0,0},margin_get_styles={2535,1,1,8},margin_get_text={2531,1,1,8},margin_set_styles={2534,0,1,7},margin_set_text={2530,0,1,7},margin_text_clear_all={2536,0,0,0},marker_add={2043,1,1,1},marker_add_set={2466,0,1,1},marker_define={2040,0,1,1},marker_define_pixmap={2049,0,1,7},marker_define_rgba_image={2626,0,1,7},marker_delete={2044,0,1,1},marker_delete_all={2045,0,1,0},marker_delete_handle={2018,0,1,0},marker_enable_highlight={2293,0,5,0},marker_get={2046,1,1,0},marker_line_from_handle={2017,1,1,0},marker_next={2047,1,1,1},marker_previous={2048,1,1,1},marker_set_alpha={2476,0,1,1},marker_set_back={2042,0,1,4},marker_set_back_selected={2292,0,1,4},marker_set_fore={2041,0,1,4},marker_symbol_defined={2529,1,1,0},move_caret_inside_view={2401,0,0,0},move_selected_lines_down={2621,0,0,0},move_selected_lines_up={2620,0,0,0},new_line={2329,0,0,0},null={2172,0,0,0},page_down={2322,0,0,0},page_down_extend={2323,0,0,0},page_down_rect_extend={2434,0,0,0},page_up={2320,0,0,0},page_up_extend={2321,0,0,0},page_up_rect_extend={2433,0,0,0},para_down={2413,0,0,0},para_down_extend={2414,0,0,0},para_up={2415,0,0,0},para_up_extend={2416,0,0,0},paste={2179,0,0,0},point_x_from_position={2164,1,0,3},point_y_from_position={2165,1,0,3},position_after={2418,3,3,0},position_before={2417,3,3,0},position_from_line={2167,3,1,0},position_from_point={2022,3,1,1},position_from_point_close={2023,3,1,1},private_lexer_call={4013,1,1,1},property_names={4014,1,0,8},property_type={4015,1,7,0},redo={2011,0,0,0},register_image={2405,0,1,7},register_rgba_image={2627,0,1,7},release_document={2377,0,0,1},replace_sel={2170,0,0,7},replace_target={2194,1,2,7},replace_target_re={2195,1,2,7},rotate_selection={2606,0,0,0},scroll_caret={2169,0,0,0},scroll_to_end={2629,0,0,0},scroll_to_start={2628,0,0,0},search_anchor={2366,0,0,0},search_in_target={2197,1,2,7},search_next={2367,1,1,7},search_prev={2368,1,1,7},select_all={2013,0,0,0},selection_duplicate={2469,0,0,0},set_chars_default={2444,0,0,0},set_empty_selection={2556,0,3,0},set_fold_flags={2233,0,1,0},set_fold_margin_colour={2290,0,5,4},set_fold_margin_hi_colour={2291,0,5,4},set_hotspot_active_back={2411,0,5,4},set_hotspot_active_fore={2410,0,5,4},set_length_for_encode={2448,0,1,0},set_lexer_language={4006,0,0,7},set_save_point={2014,0,0,0},set_sel={2160,0,3,3},set_sel_back={2068,0,5,4},set_sel_fore={2067,0,5,4},set_selection={2572,1,1,1},set_styling={2033,0,2,1},set_styling_ex={2073,0,2,7},set_text={2181,0,0,7},set_visible_policy={2394,0,1,1},set_whitespace_back={2085,0,5,4},set_whitespace_fore={2084,0,5,4},set_x_caret_policy={2402,0,1,1},set_y_caret_policy={2403,0,1,1},show_lines={2226,0,1,1},start_record={3001,0,0,0},start_styling={2032,0,3,1},stop_record={3002,0,0,0},stuttered_page_down={2437,0,0,0},stuttered_page_down_extend={2438,0,0,0},stuttered_page_up={2435,0,0,0},stuttered_page_up_extend={2436,0,0,0},style_clear_all={2050,0,0,0},style_get_font={2486,1,1,8},style_reset_default={2058,0,0,0},swap_main_anchor_caret={2607,0,0,0},tab={2327,0,0,0},target_as_utf8={2447,1,0,8},target_from_selection={2287,0,0,0},text_height={2279,1,1,0},text_width={2276,1,1,7},toggle_caret_sticky={2459,0,0,0},toggle_fold={2231,0,1,0},undo={2176,0,0,0},upper_case={2341,0,0,0},use_pop_up={2371,0,5,0},user_list_show={2117,0,1,7},vc_home={2331,0,0,0},vc_home_extend={2332,0,0,0},vc_home_rect_extend={2431,0,0,0},vc_home_wrap={2453,0,0,0},vc_home_wrap_extend={2454,0,0,0},vertical_centre_caret={2619,0,0,0},visible_from_doc_line={2220,1,1,0},word_end_position={2267,1,3,5},word_left={2308,0,0,0},word_left_end={2439,0,0,0},word_left_end_extend={2440,0,0,0},word_left_extend={2309,0,0,0},word_part_left={2390,0,0,0},word_part_left_extend={2391,0,0,0},word_part_right={2392,0,0,0},word_part_right_extend={2393,0,0,0},word_right={2310,0,0,0},word_right_end={2441,0,0,0},word_right_end_extend={2442,0,0,0},word_right_extend={2311,0,0,0},word_start_position={2266,1,3,5},wrap_count={2235,1,1,0},zoom_in={2333,0,0,0},zoom_out={2334,0,0,0}}
+M.functions = {add_ref_document={2376,0,0,1},add_selection={2573,1,1,1},add_styled_text={2002,0,2,9},add_text={2001,0,2,7},add_undo_action={2560,0,1,1},allocate={2446,0,1,0},annotation_clear_all={2547,0,0,0},annotation_get_styles={2545,1,1,8},annotation_get_text={2541,1,1,8},annotation_set_styles={2544,0,1,7},annotation_set_text={2540,0,1,7},append_text={2282,0,2,7},assign_cmd_key={2070,0,6,1},auto_c_active={2102,5,0,0},auto_c_cancel={2101,0,0,0},auto_c_complete={2104,0,0,0},auto_c_get_current={2445,1,0,0},auto_c_get_current_text={2610,1,0,8},auto_c_pos_start={2103,3,0,0},auto_c_select={2108,0,0,7},auto_c_show={2100,0,1,7},auto_c_stops={2105,0,0,7},back_tab={2328,0,0,0},begin_undo_action={2078,0,0,0},brace_bad_light={2352,0,3,0},brace_bad_light_indicator={2499,0,5,1},brace_highlight={2351,0,3,3},brace_highlight_indicator={2498,0,5,1},brace_match={2353,3,3,0},call_tip_active={2202,5,0,0},call_tip_cancel={2201,0,0,0},call_tip_pos_start={2203,3,0,0},call_tip_set_hlt={2204,0,1,1},call_tip_show={2200,0,3,7},can_paste={2173,5,0,0},can_redo={2016,5,0,0},can_undo={2174,5,0,0},cancel={2325,0,0,0},change_lexer_state={2617,1,3,3},char_left={2304,0,0,0},char_left_extend={2305,0,0,0},char_left_rect_extend={2428,0,0,0},char_position_from_point={2561,3,1,1},char_position_from_point_close={2562,3,1,1},char_right={2306,0,0,0},char_right_extend={2307,0,0,0},char_right_rect_extend={2429,0,0,0},choose_caret_x={2399,0,0,0},clear={2180,0,0,0},clear_all={2004,0,0,0},clear_all_cmd_keys={2072,0,0,0},clear_cmd_key={2071,0,6,0},clear_document_style={2005,0,0,0},clear_registered_images={2408,0,0,0},clear_selections={2571,0,0,0},colourise={4003,0,3,3},contracted_fold_next={2618,1,1,0},convert_eo_ls={2029,0,1,0},copy={2178,0,0,0},copy_allow_line={2519,0,0,0},copy_range={2419,0,3,3},copy_text={2420,0,2,7},create_document={2375,1,0,0},create_loader={2632,1,1,0},cut={2177,0,0,0},del_line_left={2395,0,0,0},del_line_right={2396,0,0,0},del_word_left={2335,0,0,0},del_word_right={2336,0,0,0},del_word_right_end={2518,0,0,0},delete_back={2326,0,0,0},delete_back_not_line={2344,0,0,0},describe_key_word_sets={4017,1,0,8},describe_property={4016,1,7,8},doc_line_from_visible={2221,1,1,0},document_end={2318,0,0,0},document_end_extend={2319,0,0,0},document_start={2316,0,0,0},document_start_extend={2317,0,0,0},edit_toggle_overtype={2324,0,0,0},empty_undo_buffer={2175,0,0,0},encoded_from_utf8={2449,1,7,8},end_undo_action={2079,0,0,0},ensure_visible={2232,0,1,0},ensure_visible_enforce_policy={2234,0,1,0},find_column={2456,1,1,1},find_text={2150,3,1,11},form_feed={2330,0,0,0},format_range={2151,3,5,12},get_cur_line={2027,1,2,8},get_hotspot_active_back={2495,4,0,0},get_hotspot_active_fore={2494,4,0,0},get_last_child={2224,1,1,1},get_lexer_language={4012,1,0,8},get_line={2153,1,1,8},get_line_sel_end_position={2425,3,1,0},get_line_sel_start_position={2424,3,1,0},get_property={4008,1,7,8},get_property_expanded={4009,1,7,8},get_sel_text={2161,1,0,8},get_styled_text={2015,1,0,10},get_tag={2616,1,1,8},get_text={2182,1,2,8},get_text_range={2162,1,0,10},goto_line={2024,0,1,0},goto_pos={2025,0,3,0},grab_focus={2400,0,0,0},hide_lines={2227,0,1,1},hide_selection={2163,0,5,0},home={2312,0,0,0},home_display={2345,0,0,0},home_display_extend={2346,0,0,0},home_extend={2313,0,0,0},home_rect_extend={2430,0,0,0},home_wrap={2349,0,0,0},home_wrap_extend={2450,0,0,0},indicator_all_on_for={2506,1,1,0},indicator_clear_range={2505,0,1,1},indicator_end={2509,1,1,1},indicator_fill_range={2504,0,1,1},indicator_start={2508,1,1,1},indicator_value_at={2507,1,1,1},insert_text={2003,0,3,7},line_copy={2455,0,0,0},line_cut={2337,0,0,0},line_delete={2338,0,0,0},line_down={2300,0,0,0},line_down_extend={2301,0,0,0},line_down_rect_extend={2426,0,0,0},line_duplicate={2404,0,0,0},line_end={2314,0,0,0},line_end_display={2347,0,0,0},line_end_display_extend={2348,0,0,0},line_end_extend={2315,0,0,0},line_end_rect_extend={2432,0,0,0},line_end_wrap={2451,0,0,0},line_end_wrap_extend={2452,0,0,0},line_from_position={2166,1,3,0},line_length={2350,1,1,0},line_scroll={2168,0,1,1},line_scroll_down={2342,0,0,0},line_scroll_up={2343,0,0,0},line_transpose={2339,0,0,0},line_up={2302,0,0,0},line_up_extend={2303,0,0,0},line_up_rect_extend={2427,0,0,0},lines_join={2288,0,0,0},lines_split={2289,0,1,0},load_lexer_library={4007,0,0,7},lower_case={2340,0,0,0},margin_get_styles={2535,1,1,8},margin_get_text={2531,1,1,8},margin_set_styles={2534,0,1,7},margin_set_text={2530,0,1,7},margin_text_clear_all={2536,0,0,0},marker_add={2043,1,1,1},marker_add_set={2466,0,1,1},marker_define={2040,0,1,1},marker_define_pixmap={2049,0,1,7},marker_define_rgba_image={2626,0,1,7},marker_delete={2044,0,1,1},marker_delete_all={2045,0,1,0},marker_delete_handle={2018,0,1,0},marker_enable_highlight={2293,0,5,0},marker_get={2046,1,1,0},marker_line_from_handle={2017,1,1,0},marker_next={2047,1,1,1},marker_previous={2048,1,1,1},marker_set_alpha={2476,0,1,1},marker_set_back={2042,0,1,4},marker_set_back_selected={2292,0,1,4},marker_set_fore={2041,0,1,4},marker_symbol_defined={2529,1,1,0},move_caret_inside_view={2401,0,0,0},move_selected_lines_down={2621,0,0,0},move_selected_lines_up={2620,0,0,0},new_line={2329,0,0,0},null={2172,0,0,0},page_down={2322,0,0,0},page_down_extend={2323,0,0,0},page_down_rect_extend={2434,0,0,0},page_up={2320,0,0,0},page_up_extend={2321,0,0,0},page_up_rect_extend={2433,0,0,0},para_down={2413,0,0,0},para_down_extend={2414,0,0,0},para_up={2415,0,0,0},para_up_extend={2416,0,0,0},paste={2179,0,0,0},point_x_from_position={2164,1,0,3},point_y_from_position={2165,1,0,3},position_after={2418,3,3,0},position_before={2417,3,3,0},position_from_line={2167,3,1,0},position_from_point={2022,3,1,1},position_from_point_close={2023,3,1,1},private_lexer_call={4013,1,1,1},property_names={4014,1,0,8},property_type={4015,1,7,0},redo={2011,0,0,0},register_image={2405,0,1,7},register_rgba_image={2627,0,1,7},release_document={2377,0,0,1},replace_sel={2170,0,0,7},replace_target={2194,1,2,7},replace_target_re={2195,1,2,7},rotate_selection={2606,0,0,0},scroll_caret={2169,0,0,0},scroll_to_end={2629,0,0,0},scroll_to_start={2628,0,0,0},search_anchor={2366,0,0,0},search_in_target={2197,1,2,7},search_next={2367,1,1,7},search_prev={2368,1,1,7},select_all={2013,0,0,0},selection_duplicate={2469,0,0,0},set_chars_default={2444,0,0,0},set_empty_selection={2556,0,3,0},set_fold_flags={2233,0,1,0},set_fold_margin_colour={2290,0,5,4},set_fold_margin_hi_colour={2291,0,5,4},set_hotspot_active_back={2411,0,5,4},set_hotspot_active_fore={2410,0,5,4},set_length_for_encode={2448,0,1,0},set_lexer_language={4006,0,0,7},set_save_point={2014,0,0,0},set_sel={2160,0,3,3},set_sel_back={2068,0,5,4},set_sel_fore={2067,0,5,4},set_selection={2572,1,1,1},set_styling={2033,0,2,1},set_styling_ex={2073,0,2,7},set_text={2181,0,0,7},set_visible_policy={2394,0,1,1},set_whitespace_back={2085,0,5,4},set_whitespace_fore={2084,0,5,4},set_x_caret_policy={2402,0,1,1},set_y_caret_policy={2403,0,1,1},show_lines={2226,0,1,1},start_record={3001,0,0,0},start_styling={2032,0,3,1},stop_record={3002,0,0,0},stuttered_page_down={2437,0,0,0},stuttered_page_down_extend={2438,0,0,0},stuttered_page_up={2435,0,0,0},stuttered_page_up_extend={2436,0,0,0},style_clear_all={2050,0,0,0},style_get_font={2486,1,1,8},style_reset_default={2058,0,0,0},swap_main_anchor_caret={2607,0,0,0},tab={2327,0,0,0},target_as_utf8={2447,1,0,8},target_from_selection={2287,0,0,0},text_height={2279,1,1,0},text_width={2276,1,1,7},toggle_caret_sticky={2459,0,0,0},toggle_fold={2231,0,1,0},undo={2176,0,0,0},upper_case={2341,0,0,0},use_pop_up={2371,0,5,0},user_list_show={2117,0,1,7},vc_home={2331,0,0,0},vc_home_extend={2332,0,0,0},vc_home_rect_extend={2431,0,0,0},vc_home_wrap={2453,0,0,0},vc_home_wrap_extend={2454,0,0,0},vertical_centre_caret={2619,0,0,0},visible_from_doc_line={2220,1,1,0},word_end_position={2267,1,3,5},word_left={2308,0,0,0},word_left_end={2439,0,0,0},word_left_end_extend={2440,0,0,0},word_left_extend={2309,0,0,0},word_part_left={2390,0,0,0},word_part_left_extend={2391,0,0,0},word_part_right={2392,0,0,0},word_part_right_extend={2393,0,0,0},word_right={2310,0,0,0},word_right_end={2441,0,0,0},word_right_end_extend={2442,0,0,0},word_right_extend={2311,0,0,0},word_start_position={2266,1,3,5},wrap_count={2235,1,1,0},zoom_in={2333,0,0,0},zoom_out={2334,0,0,0}}
---
-- Scintilla properties.
-- @class table
-- @name properties
-properties = {additional_caret_fore={2605,2604,4,0},additional_carets_blink={2568,2567,5,0},additional_carets_visible={2609,2608,5,0},additional_sel_alpha={2603,2602,1,0},additional_sel_back={0,2601,4,0},additional_sel_fore={0,2600,4,0},additional_selection_typing={2566,2565,5,0},all_lines_visible={2236,0,5,0},anchor={2009,2026,3,0},annotation_lines={2546,0,1,1},annotation_style={2543,2542,1,1},annotation_style_offset={2551,2550,1,0},annotation_visible={2549,2548,1,0},auto_c_auto_hide={2119,2118,5,0},auto_c_cancel_at_start={2111,2110,5,0},auto_c_choose_single={2114,2113,5,0},auto_c_drop_rest_of_word={2271,2270,5,0},auto_c_fill_ups={0,2112,7,0},auto_c_ignore_case={2116,2115,5,0},auto_c_max_height={2211,2210,1,0},auto_c_max_width={2209,2208,1,0},auto_c_separator={2107,2106,1,0},auto_c_type_separator={2285,2286,1,0},back_space_un_indents={2263,2262,5,0},buffered_draw={2034,2035,5,0},call_tip_back={0,2205,4,0},call_tip_fore={0,2206,4,0},call_tip_fore_hlt={0,2207,4,0},call_tip_position={0,2213,5,0},call_tip_use_style={0,2212,1,0},caret_fore={2138,2069,4,0},caret_line_back={2097,2098,4,0},caret_line_back_alpha={2471,2470,1,0},caret_line_visible={2095,2096,5,0},caret_period={2075,2076,1,0},caret_sticky={2457,2458,1,0},caret_style={2513,2512,1,0},caret_width={2189,2188,1,0},char_at={2007,0,1,3},character_pointer={2520,0,1,0},code_page={2137,2037,1,0},column={2129,0,1,3},control_char_symbol={2389,2388,1,0},current_pos={2008,2141,3,0},cursor={2387,2386,1,0},direct_function={2184,0,1,0},direct_pointer={2185,0,1,0},doc_pointer={2357,2358,1,0},eol_mode={2030,2031,1,0},edge_colour={2364,2365,4,0},edge_column={2360,2361,1,0},edge_mode={2362,2363,1,0},end_at_last_line={2278,2277,5,0},end_styled={2028,0,3,0},extra_ascent={2526,2525,1,0},extra_descent={2528,2527,1,0},first_visible_line={2152,2613,1,0},focus={2381,2380,5,0},fold_expanded={2230,2229,5,1},fold_level={2223,2222,1,1},fold_parent={2225,0,1,1},font_quality={2612,2611,1,0},h_scroll_bar={2131,2130,5,0},highlight_guide={2135,2134,1,0},hotspot_active_underline={2496,2412,5,0},hotspot_single_line={2497,2421,5,0},identifier={2623,2622,1,0},indent={2123,2122,1,0},indentation_guides={2133,2132,1,0},indic_alpha={2524,2523,1,1},indic_fore={2083,2082,4,1},indic_outline_alpha={2559,2558,1,1},indic_style={2081,2080,1,1},indic_under={2511,2510,5,1},indicator_current={2501,2500,1,0},indicator_value={2503,2502,1,0},key_words={0,4005,7,1},keys_unicode={2522,2521,5,0},layout_cache={2273,2272,1,0},length={2006,0,1,0},lexer={4002,4001,1,0},line_count={2154,0,1,0},line_end_position={2136,0,1,1},line_indent_position={2128,0,3,1},line_indentation={2127,2126,1,1},line_state={2093,2092,1,1},line_visible={2228,0,5,1},lines_on_screen={2370,0,1,0},main_selection={2575,2574,1,0},margin_cursor_n={2249,2248,1,1},margin_left={2156,2155,1,0},margin_mask_n={2245,2244,1,1},margin_options={2557,2539,1,0},margin_right={2158,2157,1,0},margin_sensitive_n={2247,2246,5,1},margin_style={2533,2532,1,1},margin_style_offset={2538,2537,1,0},margin_type_n={2241,2240,1,1},margin_width_n={2243,2242,1,1},max_line_state={2094,0,1,0},mod_event_mask={2378,2359,1,0},modify={2159,0,5,0},mouse_down_captures={2385,2384,5,0},mouse_dwell_time={2265,2264,1,0},multi_paste={2615,2614,1,0},multiple_selection={2564,2563,5,0},overtype={2187,2186,5,0},paste_convert_endings={2468,2467,5,0},position_cache={2515,2514,1,0},print_colour_mode={2149,2148,1,0},print_magnification={2147,2146,1,0},print_wrap_mode={2407,2406,1,0},property={0,4004,7,7},property_int={4010,0,1,7},rgba_image_height={0,2625,1,0},rgba_image_width={0,2624,1,0},read_only={2140,2171,5,0},rectangular_selection_anchor={2591,2590,3,0},rectangular_selection_anchor_virtual_space={2595,2594,1,0},rectangular_selection_caret={2589,2588,3,0},rectangular_selection_caret_virtual_space={2593,2592,1,0},rectangular_selection_modifier={2599,2598,1,0},scroll_width={2275,2274,1,0},scroll_width_tracking={2517,2516,5,0},search_flags={2199,2198,1,0},sel_alpha={2477,2478,1,0},sel_eol_filled={2479,2480,5,0},selection_end={2145,2144,3,0},selection_is_rectangle={2372,0,5,0},selection_mode={2423,2422,1,0},selection_n_anchor={2579,2578,3,1},selection_n_anchor_virtual_space={2583,2582,1,1},selection_n_caret={2577,2576,3,1},selection_n_caret_virtual_space={2581,2580,1,1},selection_n_end={2587,2586,3,1},selection_n_start={2585,2584,3,1},selection_start={2143,2142,3,0},selections={2570,0,1,0},status={2383,2382,1,0},style_at={2010,0,1,3},style_back={2482,2052,4,1},style_bits={2091,2090,1,0},style_bits_needed={4011,0,1,0},style_bold={2483,2053,5,1},style_case={2489,2060,1,1},style_changeable={2492,2099,5,1},style_character_set={2490,2066,1,1},style_eol_filled={2487,2057,5,1},style_font={0,2056,7,1},style_fore={2481,2051,4,1},style_hot_spot={2493,2409,5,1},style_italic={2484,2054,5,1},style_size={2485,2055,1,1},style_size_fractional={2062,2061,1,1},style_underline={2488,2059,5,1},style_visible={2491,2074,5,1},style_weight={2064,2063,1,1},tab_indents={2261,2260,5,0},tab_width={2121,2036,1,0},target_end={2193,2192,3,0},target_start={2191,2190,3,0},technology={2631,2630,1,0},text_length={2183,0,1,0},two_phase_draw={2283,2284,5,0},undo_collection={2019,2012,5,0},use_tabs={2125,2124,5,0},v_scroll_bar={2281,2280,5,0},view_eol={2355,2356,5,0},view_ws={2020,2021,1,0},virtual_space_options={2597,2596,1,0},whitespace_chars={0,2443,7,0},whitespace_size={2087,2086,1,0},word_chars={0,2077,7,0},wrap_indent_mode={2473,2472,1,0},wrap_mode={2269,2268,1,0},wrap_start_indent={2465,2464,1,0},wrap_visual_flags={2461,2460,1,0},wrap_visual_flags_location={2463,2462,1,0},x_offset={2398,2397,1,0},zoom={2374,2373,1,0}}
+M.properties = {additional_caret_fore={2605,2604,4,0},additional_carets_blink={2568,2567,5,0},additional_carets_visible={2609,2608,5,0},additional_sel_alpha={2603,2602,1,0},additional_sel_back={0,2601,4,0},additional_sel_fore={0,2600,4,0},additional_selection_typing={2566,2565,5,0},all_lines_visible={2236,0,5,0},anchor={2009,2026,3,0},annotation_lines={2546,0,1,1},annotation_style={2543,2542,1,1},annotation_style_offset={2551,2550,1,0},annotation_visible={2549,2548,1,0},auto_c_auto_hide={2119,2118,5,0},auto_c_cancel_at_start={2111,2110,5,0},auto_c_choose_single={2114,2113,5,0},auto_c_drop_rest_of_word={2271,2270,5,0},auto_c_fill_ups={0,2112,7,0},auto_c_ignore_case={2116,2115,5,0},auto_c_max_height={2211,2210,1,0},auto_c_max_width={2209,2208,1,0},auto_c_separator={2107,2106,1,0},auto_c_type_separator={2285,2286,1,0},back_space_un_indents={2263,2262,5,0},buffered_draw={2034,2035,5,0},call_tip_back={0,2205,4,0},call_tip_fore={0,2206,4,0},call_tip_fore_hlt={0,2207,4,0},call_tip_position={0,2213,5,0},call_tip_use_style={0,2212,1,0},caret_fore={2138,2069,4,0},caret_line_back={2097,2098,4,0},caret_line_back_alpha={2471,2470,1,0},caret_line_visible={2095,2096,5,0},caret_period={2075,2076,1,0},caret_sticky={2457,2458,1,0},caret_style={2513,2512,1,0},caret_width={2189,2188,1,0},char_at={2007,0,1,3},character_pointer={2520,0,1,0},code_page={2137,2037,1,0},column={2129,0,1,3},control_char_symbol={2389,2388,1,0},current_pos={2008,2141,3,0},cursor={2387,2386,1,0},direct_function={2184,0,1,0},direct_pointer={2185,0,1,0},doc_pointer={2357,2358,1,0},eol_mode={2030,2031,1,0},edge_colour={2364,2365,4,0},edge_column={2360,2361,1,0},edge_mode={2362,2363,1,0},end_at_last_line={2278,2277,5,0},end_styled={2028,0,3,0},extra_ascent={2526,2525,1,0},extra_descent={2528,2527,1,0},first_visible_line={2152,2613,1,0},focus={2381,2380,5,0},fold_expanded={2230,2229,5,1},fold_level={2223,2222,1,1},fold_parent={2225,0,1,1},font_quality={2612,2611,1,0},h_scroll_bar={2131,2130,5,0},highlight_guide={2135,2134,1,0},hotspot_active_underline={2496,2412,5,0},hotspot_single_line={2497,2421,5,0},identifier={2623,2622,1,0},indent={2123,2122,1,0},indentation_guides={2133,2132,1,0},indic_alpha={2524,2523,1,1},indic_fore={2083,2082,4,1},indic_outline_alpha={2559,2558,1,1},indic_style={2081,2080,1,1},indic_under={2511,2510,5,1},indicator_current={2501,2500,1,0},indicator_value={2503,2502,1,0},key_words={0,4005,7,1},keys_unicode={2522,2521,5,0},layout_cache={2273,2272,1,0},length={2006,0,1,0},lexer={4002,4001,1,0},line_count={2154,0,1,0},line_end_position={2136,0,1,1},line_indent_position={2128,0,3,1},line_indentation={2127,2126,1,1},line_state={2093,2092,1,1},line_visible={2228,0,5,1},lines_on_screen={2370,0,1,0},main_selection={2575,2574,1,0},margin_cursor_n={2249,2248,1,1},margin_left={2156,2155,1,0},margin_mask_n={2245,2244,1,1},margin_options={2557,2539,1,0},margin_right={2158,2157,1,0},margin_sensitive_n={2247,2246,5,1},margin_style={2533,2532,1,1},margin_style_offset={2538,2537,1,0},margin_type_n={2241,2240,1,1},margin_width_n={2243,2242,1,1},max_line_state={2094,0,1,0},mod_event_mask={2378,2359,1,0},modify={2159,0,5,0},mouse_down_captures={2385,2384,5,0},mouse_dwell_time={2265,2264,1,0},multi_paste={2615,2614,1,0},multiple_selection={2564,2563,5,0},overtype={2187,2186,5,0},paste_convert_endings={2468,2467,5,0},position_cache={2515,2514,1,0},print_colour_mode={2149,2148,1,0},print_magnification={2147,2146,1,0},print_wrap_mode={2407,2406,1,0},property={0,4004,7,7},property_int={4010,0,1,7},rgba_image_height={0,2625,1,0},rgba_image_width={0,2624,1,0},read_only={2140,2171,5,0},rectangular_selection_anchor={2591,2590,3,0},rectangular_selection_anchor_virtual_space={2595,2594,1,0},rectangular_selection_caret={2589,2588,3,0},rectangular_selection_caret_virtual_space={2593,2592,1,0},rectangular_selection_modifier={2599,2598,1,0},scroll_width={2275,2274,1,0},scroll_width_tracking={2517,2516,5,0},search_flags={2199,2198,1,0},sel_alpha={2477,2478,1,0},sel_eol_filled={2479,2480,5,0},selection_end={2145,2144,3,0},selection_is_rectangle={2372,0,5,0},selection_mode={2423,2422,1,0},selection_n_anchor={2579,2578,3,1},selection_n_anchor_virtual_space={2583,2582,1,1},selection_n_caret={2577,2576,3,1},selection_n_caret_virtual_space={2581,2580,1,1},selection_n_end={2587,2586,3,1},selection_n_start={2585,2584,3,1},selection_start={2143,2142,3,0},selections={2570,0,1,0},status={2383,2382,1,0},style_at={2010,0,1,3},style_back={2482,2052,4,1},style_bits={2091,2090,1,0},style_bits_needed={4011,0,1,0},style_bold={2483,2053,5,1},style_case={2489,2060,1,1},style_changeable={2492,2099,5,1},style_character_set={2490,2066,1,1},style_eol_filled={2487,2057,5,1},style_font={0,2056,7,1},style_fore={2481,2051,4,1},style_hot_spot={2493,2409,5,1},style_italic={2484,2054,5,1},style_size={2485,2055,1,1},style_size_fractional={2062,2061,1,1},style_underline={2488,2059,5,1},style_visible={2491,2074,5,1},style_weight={2064,2063,1,1},tab_indents={2261,2260,5,0},tab_width={2121,2036,1,0},target_end={2193,2192,3,0},target_start={2191,2190,3,0},technology={2631,2630,1,0},text_length={2183,0,1,0},two_phase_draw={2283,2284,5,0},undo_collection={2019,2012,5,0},use_tabs={2125,2124,5,0},v_scroll_bar={2281,2280,5,0},view_eol={2355,2356,5,0},view_ws={2020,2021,1,0},virtual_space_options={2597,2596,1,0},whitespace_chars={0,2443,7,0},whitespace_size={2087,2086,1,0},word_chars={0,2077,7,0},wrap_indent_mode={2473,2472,1,0},wrap_mode={2269,2268,1,0},wrap_start_indent={2465,2464,1,0},wrap_visual_flags={2461,2460,1,0},wrap_visual_flags_location={2463,2462,1,0},x_offset={2398,2397,1,0},zoom={2374,2373,1,0}}
local marker_number, indic_number, list_type = -1, 7, 0
@@ -31,7 +34,8 @@ local marker_number, indic_number, list_type = -1, 7, 0
-- identifiers of other custom markers.
-- @usage local marknum = _SCINTILLA.next_marker_number()
-- @see buffer.marker_define
-function next_marker_number()
+-- @name next_marker_number
+function M.next_marker_number()
marker_number = marker_number + 1
return marker_number
end
@@ -42,7 +46,8 @@ end
-- identifiers of other custom indicators.
-- @usage local indic_num = _SCINTILLA.next_indic_number()
-- @see buffer.indic_style
-function next_indic_number()
+-- @name next_indic_number
+function M.next_indic_number()
indic_number = indic_number + 1
return indic_number
end
@@ -53,7 +58,10 @@ end
-- type identifiers of other custom user lists.
-- @usage local list_type = _SCINTILLA.next_user_list_type()
-- @see buffer.user_list_show
-function next_user_list_type()
+-- @name next_user_list_type
+function M.next_user_list_type()
list_type = list_type + 1
return list_type
end
+
+return M
diff --git a/core/init.lua b/core/init.lua
index 9f6a15da..18077169 100644
--- a/core/init.lua
+++ b/core/init.lua
@@ -5,22 +5,118 @@ _RELEASE = "Textadept 4.3"
package.path = _HOME..'/core/?.lua;'..package.path
os.setlocale('C', 'collate')
-require 'iface'
-require 'args'
-require 'locale'
-require 'events'
+_SCINTILLA = require 'iface'
+args = require 'args'
+locale = require 'locale'
+events = require 'events'
require 'file_io'
require 'gui'
-require 'keys'
+keys = require 'keys'
_LEXERPATH = _USERHOME..'/lexers/?.lua;'.._HOME..'/lexers'
gui.set_theme()
--- LuaDoc is in core/._G.luadoc.
+_m = {} -- modules table
+
+--[[ This comment is for LuaDoc.
+--- Extends Lua's _G table to provide extra functions and fields.
+module('_G')]]
+
+-- Markdown:
+-- ## Fields
+--
+-- * `_HOME` [string]: Path to the directory containing Textadept.
+-- * `_LEXERPATH` [string]: Paths to lexers, formatted like
+-- [`package.path`][package_path].
+-- * `_RELEASE` [string]: The Textadept release version.
+-- * `_USERHOME` [string]: Path to the user's `~/.textadept/`.
+-- * `_CHARSET` [string]: The character set encoding of the filesystem. This is
+-- used in [File I/O](../modules/io.html).
+-- * `RESETTING` [bool]: If [`reset()`](../modules/_G.html#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`.
+-- * `OSX` [bool]: If Textadept is running on Mac OSX, this flag is `true`.
+--
+-- [package_path]: http://www.lua.org/manual/5.1/manual.html#pdf-package.path
+
+---
+-- Calls `dofile()` on the given filename in the user's Textadept directory.
+-- Errors are printed to the Textadept message buffer.
+-- @param filename The name of the file (not path).
+-- @return true if successful; false otherwise.
+-- @see dofile
function user_dofile(filename)
if not lfs.attributes(_USERHOME..'/'..filename) then return false end
local ok, err = pcall(dofile, _USERHOME..'/'..filename)
if not ok then gui.print(err) end
return ok
end
+
+-- The tables below were defined in C.
+
+---
+-- Command line parameters.
+-- @class table
+-- @name arg
+local arg
+
+---
+-- Table of all open buffers in Textadept.
+-- Numeric keys have buffer values and buffer keys have their associated numeric
+-- keys.
+-- @class table
+-- @name _BUFFERS
+-- @usage _BUFFERS[1] contains the first buffer.
+-- @usage _BUFFERS[buffer] returns the index of the current buffer in _BUFFERS.
+local _BUFFERS
+
+---
+-- Table of all views in Textadept.
+-- Numeric keys have view values and view keys have their associated numeric
+-- keys.
+-- @class table
+-- @name _VIEWS
+-- @usage _VIEWS[1] contains the first view.
+-- @usage _VIEWS[view] returns the index of the current view in _VIEWS.
+local _VIEWS
+
+-- The functions below are Lua C functions.
+
+---
+-- Creates a new buffer.
+-- Generates a `BUFFER_NEW` event.
+-- @return the new buffer.
+-- @class function
+-- @name new_buffer
+local new_buffer
+
+---
+-- Quits Textadept.
+-- @class function
+-- @name quit
+local quit
+
+---
+-- 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.
+-- @class function
+-- @name reset
+local reset
+
+---
+-- 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.
+-- @param interval The interval in seconds to call the function after.
+-- @param f The function to call.
+-- @param ... Additional arguments to pass to `f`.
+-- @class function
+-- @name timeout
+local timeout
diff --git a/core/keys.lua b/core/keys.lua
index 61d8ba55..46bd1a9c 100644
--- a/core/keys.lua
+++ b/core/keys.lua
@@ -2,9 +2,12 @@
local L = locale.localize
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Manages key commands in Textadept.
-module('keys', package.seeall)
+module('keys', package.seeall)]]
-- Markdown:
-- ## Overview
@@ -99,8 +102,8 @@ local CTRL = 'c'..ADD
local ALT = 'a'..ADD
local META = 'm'..ADD
local SHIFT = 's'..ADD
-CLEAR = 'esc'
-LANGUAGE_MODULE_PREFIX = (not OSX and CTRL or META)..'l'
+M.CLEAR = 'esc'
+M.LANGUAGE_MODULE_PREFIX = (not OSX and CTRL or META)..'l'
-- end settings
-- Optimize for speed.
@@ -119,7 +122,7 @@ local error = function(e) events.emit(events.ERROR, e) end
-- return a string representation of the key if it exists.
-- @class table
-- @name KEYSYMS
-KEYSYMS = { -- from <gdk/gdkkeysyms.h>
+M.KEYSYMS = { -- from <gdk/gdkkeysyms.h>
[0xFE20] = '\t', -- backtab; will be 'shift'ed
[0xFF08] = '\b',
[0xFF09] = '\t',
@@ -168,7 +171,7 @@ local function run_command(command, command_type)
local _, result = xpcall(f, error, table_unpack(args, 2))
return result
end
-_M.run_command = run_command -- export for menu.lua without creating LuaDoc
+M.run_command = run_command -- export for menu.lua without creating LuaDoc
-- Return codes for `run_key_command()`.
local INVALID = -1
@@ -212,12 +215,12 @@ end
local function keypress(code, shift, control, alt, meta)
local buffer = buffer
local key
- --print(code, keys.KEYSYMS[ch], shift, control, alt, meta)
+ --print(code, M.KEYSYMS[ch], shift, control, alt, meta)
if code < 256 then
key = string_char(code)
shift = false -- for printable characters, key is upper case
else
- key = KEYSYMS[code]
+ key = M.KEYSYMS[code]
if not key then return end
end
control = control and CTRL or ''
@@ -227,7 +230,7 @@ local function keypress(code, shift, control, alt, meta)
local key_seq = control..alt..meta..shift..key
--print(key_seq)
- if #keychain > 0 and key_seq == keys.CLEAR then
+ if #keychain > 0 and key_seq == M.CLEAR then
clear_key_sequence()
return true
end
@@ -273,10 +276,12 @@ local function get_gdk_key(key_seq)
(mods:find('a') and 8 or 0) + (mods:find('m') and 4 or 0)
local byte = string_byte(key)
if #key > 1 or byte < 32 then
- for i, s in pairs(KEYSYMS) do
+ for i, s in pairs(M.KEYSYMS) do
if s == key and i ~= 0xFE20 then byte = i break end
end
end
return byte, modifiers
end
-_M.get_gdk_key = get_gdk_key -- export for menu.lua without generating LuaDoc
+M.get_gdk_key = get_gdk_key -- export for menu.lua without generating LuaDoc
+
+return M
diff --git a/core/locale.lua b/core/locale.lua
index 4274a0e9..29885848 100644
--- a/core/locale.lua
+++ b/core/locale.lua
@@ -1,8 +1,11 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Contains all messages used by Textadept for localization.
-module('locale', package.seeall)
+module('locale', package.seeall)]]
-- Markdown:
-- ## Fields
@@ -29,4 +32,7 @@ f:close()
---
-- Localizes the given string.
-- @param id String to localize.
-function localize(id) return localizations[id] or 'No Localization' end
+-- @name localize
+function M.localize(id) return localizations[id] or 'No Localization' end
+
+return M
diff --git a/doc/manual/11_Scripting.md b/doc/manual/11_Scripting.md
index c73819a8..6be71b7b 100644
--- a/doc/manual/11_Scripting.md
+++ b/doc/manual/11_Scripting.md
@@ -17,18 +17,15 @@ examples since Textadept is mostly written in Lua.
## Lua Configuration
-[Lua 5.1](http://www.lua.org/manual/5.1/) is built into Textadept. It has the
+[Lua 5.2](http://www.lua.org/manual/5.2/) is built into Textadept. It 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`.
* `LUA_ROOT` is `/usr/` in Linux systems instead of `/usr/local/`.
-* The `LUA_COMPAT_VARARG`, `LUA_COMPAT_MOD`, `LUA_COMPAT_GFIND`, and
- `LUA_COMPAT_OPENLIB` compatibility flags for Lua 5.0 are turned off.
-
-In addition, the [Lua Coco](http://coco.luajit.org/index.html) extension is used
-to allow coroutines to yield across the C call boundary, which would normally
-cause an error.
+* The `LUA_COMPAT_COMPAT`, `LUA_COMPAT_LOADERS`, `LUA_COMPAT_LOG10`,
+ `LUA_COMPAT_LOADSTRING`, and `LUA_COMPAT_MAXN` compatibility flags for Lua 5.1
+ are turned off.
## Scintilla
diff --git a/doc/manual/14_Appendix.md b/doc/manual/14_Appendix.md
index 71dacb1f..d19257d1 100644
--- a/doc/manual/14_Appendix.md
+++ b/doc/manual/14_Appendix.md
@@ -191,7 +191,7 @@ Ctrl+Shift+U, xxxx, Enter|None|Input Unicode character U-xxxx.
## Lua Patterns
The following is taken from the
-[Lua 5.1 Reference Manual](http://www.lua.org/manual/5.1/manual.html#5.4.1).
+[Lua 5.2 Reference Manual](http://www.lua.org/manual/5.2/manual.html#6.4.1).
_Character Class:_
@@ -204,13 +204,13 @@ combinations are allowed in describing a character class:
* **`%a`:** represents all letters.
* **`%c`:** represents all control characters.
* **`%d`:** represents all digits.
+* **`%g`:** represents all printable characters except space.
* **`%l`:** represents all lowercase letters.
* **`%p`:** represents all punctuation characters.
* **`%s`:** represents all space characters.
* **`%u`:** represents all uppercase letters.
* **`%w`:** represents all alphanumeric characters.
* **`%x`:** represents all hexadecimal digits.
-* **`%z`:** represents the character with representation 0.
* **`%`_`x`_:** (where _x_ is any non-alphanumeric character) represents the
character _x_. This is the standard way to escape the magic characters. Any
punctuation character (even the non magic) can be preceded by a '`%`' when
@@ -259,6 +259,11 @@ A _pattern item_ can be
counting +_1_ for an _x_ and -_1_ for a _y_, the ending _y_ is the first _y_
where the count reaches 0. For instance, the item `%b()` matches expressions
with balanced parentheses.
+* `%f[set]`, a _frontier pattern_; such item matches an empty string at any
+ position such that the next character belongs to _set_ and the previous
+ character does not belong to _set_. The set _set_ is interpreted as previously
+ described. The beginning and the end of the subject are handled as if they
+ were the character `'\0'`.
_Pattern:_
@@ -280,5 +285,3 @@ is captured with number 2, and the part matching "`%s*`" has number 3.
As a special case, the empty capture `()` captures the current string position
(a number). For instance, if we apply the pattern `"()aa()"` on the string
`"flaaap"`, there will be two captures: 3 and 5.
-
-A pattern cannot contain embedded zeros. Use `%z` instead.
diff --git a/doc/manual/7_Modules.md b/doc/manual/7_Modules.md
index 57845121..4885b9cd 100644
--- a/doc/manual/7_Modules.md
+++ b/doc/manual/7_Modules.md
@@ -135,9 +135,7 @@ a `post_init.lua` file. For example, instead of copying the `lua` module and
changing its `set_buffer_properties()` function to use tabs, you can do this
from `post_init.lua`:
- module('_m.lua', package.seeall)
-
- function set_buffer_properties()
+ function _m.lua.set_buffer_properties()
buffer.use_tabs = true
end
diff --git a/doc/manual/9_Preferences.md b/doc/manual/9_Preferences.md
index e86ba132..f94fff87 100644
--- a/doc/manual/9_Preferences.md
+++ b/doc/manual/9_Preferences.md
@@ -23,20 +23,21 @@ menu, replace
with
- require 'textadept.adeptsense'
- require 'textadept.bookmarks'
+ _m.textadept = {}
+ _m.textadept.adeptsense = require 'textadept.adeptsense'
+ _m.textadept.bookmarks = require 'textadept.bookmarks'
require 'textadept.command_entry'
- require 'textadept.editing'
+ _m.textadept.editing = require 'textadept.editing'
require 'textadept.find'
- require 'textadept.filter_through'
- require 'textadept.mime_types'
- require 'textadept.run'
- require 'textadept.session'
- require 'textadept.snapopen'
- require 'textadept.snippets'
-
- require 'textadept.keys'
- --require 'textadept.menu'
+ _m.textadept.filter_through = require 'textadept.filter_through'
+ _m.textadept.mime_types = require 'textadept.mime_types'
+ _m.textadept.run = require 'textadept.run'
+ _m.textadept.session = require 'textadept.session'
+ _m.textadept.snapopen = require 'textadept.snapopen'
+ _m.textadept.snippets = require 'textadept.snippets'
+
+ _m.textadept.keys = require 'textadept.keys'
+ --_m.textadept.menu = require 'textadept.menu'
Note that his list was obtained from the `textadept` module's `init.lua` which
is located in the `modules/textadept/` directory.
diff --git a/modules/cpp/init.lua b/modules/cpp/init.lua
index edad0d9a..63401b16 100644
--- a/modules/cpp/init.lua
+++ b/modules/cpp/init.lua
@@ -1,11 +1,14 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- The cpp module.
-- It provides utilities for editing C/C++ code.
-- User tags are loaded from _USERHOME/modules/cpp/tags and user apis are loaded
-- from _USERHOME/modules/cpp/api.
-module('_m.cpp', package.seeall)
+module('_m.cpp', package.seeall)]]
-- Markdown:
-- ## Key Commands
@@ -38,14 +41,15 @@ m_run.error_detail.c = {
---
-- Sets default buffer properties for C/C++ files.
-function set_buffer_properties()
+-- @name set_buffer_properties
+function M.set_buffer_properties()
end
-- Adeptsense.
-sense = _m.textadept.adeptsense.new('cpp')
-sense.ctags_kinds = {
+M.sense = _m.textadept.adeptsense.new('cpp')
+M.sense.ctags_kinds = {
c = 'classes',
d = 'functions',
e = 'fields',
@@ -55,20 +59,20 @@ sense.ctags_kinds = {
s = 'classes',
t = 'classes'
}
-sense:load_ctags(_HOME..'/modules/cpp/tags', true)
-sense.api_files = { _HOME..'/modules/cpp/api', _HOME..'/modules/cpp/lua_api' }
-sense.syntax.type_declarations = {
+M.sense:load_ctags(_HOME..'/modules/cpp/tags', true)
+M.sense.api_files = { _HOME..'/modules/cpp/api', _HOME..'/modules/cpp/lua_api' }
+M.sense.syntax.type_declarations = {
'([%w_%.]+)[%s%*&]+%_[^%w_]', -- Foo bar, Foo *bar, Foo* bar, Foo &bar, etc.
}
-sense:add_trigger('.')
-sense:add_trigger('->')
+M.sense:add_trigger('.')
+M.sense:add_trigger('->')
-- Load user tags and apidoc.
if lfs.attributes(_USERHOME..'/modules/cpp/tags') then
- sense:load_ctags(_USERHOME..'/modules/cpp/tags')
+ M.sense:load_ctags(_USERHOME..'/modules/cpp/tags')
end
if lfs.attributes(_USERHOME..'/modules/cpp/api') then
- sense.api_files[#sense.api_files + 1] = _USERHOME..'/modules/cpp/api'
+ M.sense.api_files[#M.sense.api_files + 1] = _USERHOME..'/modules/cpp/api'
end
-- Commands.
@@ -162,3 +166,5 @@ if type(snippets) == 'table' then
llos = 'luaL_optstring(%1(lua), %2(-1), %3(default))',
}
end
+
+return M
diff --git a/modules/cpp/lua_api b/modules/cpp/lua_api
index 2d660647..719846a5 100644
--- a/modules/cpp/lua_api
+++ b/modules/cpp/lua_api
@@ -1,26 +1,30 @@
-lua_Alloc (*lua_Alloc)(void *ud, void *ptr, size_t osize, size_t nsize) [void*]\nThe type of the memory-allocation function used by Lua states. The allocator\nfunction must provide a functionality similar to `realloc`, but not exactly\nthe same. Its arguments are `ud`, an opaque pointer passed to `lua_newstate`;\n`ptr`, a pointer to the block being allocated/reallocated/freed; `osize`,\nthe original size of the block; `nsize`, the new size of the block.\n`ptr` is `NULL` if and only if `osize` is zero. When `nsize` is zero,\nthe allocator must return `NULL`; if `osize` is not zero, it should free\nthe block pointed to by `ptr`. When `nsize` is not zero, the allocator\nreturns `NULL` if and only if it cannot fill the request. When `nsize`\nis not zero and `osize` is zero, the allocator should behave like `malloc`.\nWhen `nsize` and `osize` are not zero, the allocator behaves like `realloc`.\nLua assumes that the allocator never fails when `osize >= nsize`.\n\nHere is a simple implementation for the allocator function. It is used in\nthe auxiliary library by `luaL_newstate`.\n\n static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {\n (void)ud; (void)osize; /* not used */\n if (nsize == 0) {\n free(ptr);\n return NULL;\n }\n else\n return realloc(ptr, nsize);\n }\n\nThis code assumes that `free(NULL)` has no effect and that `realloc(NULL,\nsize)` is equivalent to `malloc(size)`. ANSI C ensures both behaviors.\n
-lua_atpanic lua_atpanic(lua_State *L, lua_CFunction panicf) [lua_CFunction]\nSets a new panic function and returns the old one.\nIf an error happens outside any protected environment, Lua calls a _panic\nfunction_ and then calls `exit(EXIT_FAILURE)`, thus exiting the host\napplication. Your panic function can avoid this exit by never returning\n(e.g., doing a long jump).\nThe panic function can access the error message at the top of the stack.\n
-lua_call lua_call(lua_State *L, int nargs, int nresults) [void]\nCalls a function.\n\nTo call a function you must use the following protocol: first, the function\nto be called is pushed onto the stack; then, the arguments to the function\nare pushed in direct order; that is, the first argument is pushed first.\nFinally you call `lua_call`; `nargs` is the number of arguments that you\npushed onto the stack. All arguments and the function value are popped from\nthe stack when the function is called. The function results are pushed onto\nthe stack when the function returns. The number of results is adjusted to\n`nresults`, unless `nresults` is `LUA_MULTRET`. In this case, _all_\nresults from the function are pushed. Lua takes care that the returned\nvalues fit into the stack space. The function results are pushed onto the\nstack in direct order (the first result is pushed first), so that after the\ncall the last result is on the top of the stack.\n\nAny error inside the called function is propagated upwards (with a `longjmp`).\n\nThe following example shows how the host program can do the equivalent to\nthis Lua code:\n\n a = f("how", t.x, 14)\n\nHere it is in C:\n\n lua_getfield(L, LUA_GLOBALSINDEX, "f"); /* function to be called */\n lua_pushstring(L, "how"); /* 1st argument */\n lua_getfield(L, LUA_GLOBALSINDEX, "t"); /* table to be indexed */\n lua_getfield(L, -1, "x"); /* push result of t.x (2nd arg) */\n lua_remove(L, -2); /* remove 't' from the stack */\n lua_pushinteger(L, 14); /* 3rd argument */\n lua_call(L, 3, 1); /* call 'f' with 3 arguments and 1 result */\n lua_setfield(L, LUA_GLOBALSINDEX, "a"); /* set global 'a' */\n\nNote that the code above is "balanced": at its end, the stack is back to\nits original configuration. This is considered good programming practice.\n
+lua_absindex lua_absindex(lua_State *L, int idx) [int]\nConverts the acceptable index `idx` into an absolute index (that is, one that\ndoes not depend on the stack top).\n
+lua_Alloc (*lua_Alloc)(void *ud, void *ptr, size_t osize, size_t nsize) [void*]\nThe type of the memory-allocation function used by Lua states. The allocator\nfunction must provide a functionality similar to `realloc`, but not exactly\nthe same. Its arguments are `ud`, an opaque pointer passed to `lua_newstate`;\n`ptr`, a pointer to the block being allocated/reallocated/freed; `osize`,\nthe original size of the block or some code about what is being allocated;\n`nsize`, the new size of the block.\n\nWhen `ptr` is not `NULL`, `osize` is the size of the block pointed by `ptr`,\nthat is, the size given when it was allocated or reallocated.\n\nWhen `ptr` is `NULL`, `osize` encodes the kind of object that Lua is allocating.\n`osize` is any of `LUA_TSTRING`, `LUA_TTABLE`, `LUA_TFUNCTION`, `LUA_TUSERDATA`,\nor `LUA_TTHREAD` when (and only when) Lua is creating a new object of that type.\nWhen `osize` is some other value, Lua is allocating memory for something else.\n\nLua assumes the following behavior from the allocator function:\n\nWhen `nsize` is zero, the allocator should behave like `free` and return `NULL`.\n\nWhen `nsize` is not zero, the allocator should behave like `realloc`. The\nallocator returns `NULL` if and only if it cannot fulfill the request. Lua\nassumes that the allocator never fails when `osize >= nsize`.\n\nHere is a simple implementation for the allocator function. It is used in\nthe auxiliary library by `luaL_newstate`.\n\n static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {\n (void)ud; (void)osize; /* not used */\n if (nsize == 0) {\n free(ptr);\n return NULL;\n }\n else\n return realloc(ptr, nsize);\n }\n\nNote that Standard C ensures that `free(NULL)` has no effect and that\n`realloc(NULL, size)` is equivalent to `malloc(size)`. This code assumes that\n`realloc` does not fail when shrinking a block. (Although Standard C does not\nensure this behavior, it seems to be a safe assumption.)\n
+lua_arith lua_arith(lua_State *L, int op) [int]\nPerforms an arithmetic operation over the two values (or one, in the case of\nnegation) at the top of the stack, with the value at the top being the second\noperand, pops these values, and pushes the result of the operation. The\nfunction follows the semantics of the corresponding Lua operator (that is, it\nmay call metamethods).\n\nThe value of `op` must be one of the following constants:\n * LUA_OPADD: performs addition (`+`)\n * LUA_OPSUB: performs subtraction (`-`)\n * LUA_OPMUL: performs multiplication (`*`)\n * LUA_OPDIV: performs division (`/`)\n * LUA_OPMOD: performs modulo (`%`)\n * LUA_OPPOW: performs exponentiation (`^`)\n * LUA_OPUNM: performs mathematical negation (unary `-`)\n
+lua_atpanic lua_atpanic(lua_State *L, lua_CFunction panicf) [lua_CFunction]\nSets a new panic function and returns the old one (see §4.6).\n\nIf an error happens outside any protected environment, Lua calls a _panic\nfunction_ and then calls `abort`, thus exiting the host application. Your panic\nfunction can avoid this exit by never returning (e.g., doing a long jump).\n\nThe panic function runs as if it were a message handler (see §2.3); in\nparticular, the error message is at the top of the stack. However, there is no\nguarantees about stack space. To push anything on the stack, the panic function\nshould first check the available space (see §4.2).\n
+lua_call lua_call(lua_State *L, int nargs, int nresults) [void]\nCalls a function.\n\nTo call a function you must use the following protocol: first, the function\nto be called is pushed onto the stack; then, the arguments to the function\nare pushed in direct order; that is, the first argument is pushed first.\nFinally you call `lua_call`; `nargs` is the number of arguments that you\npushed onto the stack. All arguments and the function value are popped from\nthe stack when the function is called. The function results are pushed onto\nthe stack when the function returns. The number of results is adjusted to\n`nresults`, unless `nresults` is `LUA_MULTRET`. In this case, all results from\nthe function are pushed. Lua takes care that the returned values fit into the\nstack space. The function results are pushed onto the stack in direct order\n(the first result is pushed first), so that after the call the last result is on\nthe top of the stack.\n\nAny error inside the called function is propagated upwards (with a `longjmp`).\n\nThe following example shows how the host program can do the equivalent to\nthis Lua code:\n\n a = f("how", t.x, 14)\n\nHere it is in C:\n\n lua_getglobal(L, "f"); /* function to be called */\n lua_pushstring(L, "how"); /* 1st argument */\n lua_getglobal(L, "t"); /* table to be indexed */\n lua_getfield(L, -1, "x"); /* push result of t.x (2nd arg) */\n lua_remove(L, -2); /* remove 't' from the stack */\n lua_pushinteger(L, 14); /* 3rd argument */\n lua_call(L, 3, 1); /* call 'f' with 3 arguments and 1 result */\n lua_setglobal(L, "a"); /* set global 'a' */\n\nNote that the code above is "balanced": at its end, the stack is back to\nits original configuration. This is considered good programming practice.\n
+lua_callk lua_callk(lua_State *L, int nargs, int nresults, int ctx, lua_CFunction k) [void]\nThis function behaves exactly like `lua_call`, but allows the called function to\nyield (see §4.7).\n
lua_CFunction (*lua_CFunction)(lua_State *L) [int]\nType for C functions.\n\nIn order to communicate properly with Lua, a C function must use the\nfollowing protocol, which defines the way parameters and results are passed:\na C function receives its arguments from Lua in its stack in direct order\n(the first argument is pushed first). So, when the function starts,\n`lua_gettop(L)` returns the number of arguments received by the function.\nThe first argument (if any) is at index 1 and its last argument is at index\n`lua_gettop(L)`. To return values to Lua, a C function just pushes them onto\nthe stack, in direct order (the first result is pushed first), and returns\nthe number of results. Any other value in the stack below the results will\nbe properly discarded by Lua. Like a Lua function, a C function called by\nLua can also return many results.\n\nAs an example, the following function receives a variable number of numerical\narguments and returns their average and sum:\n\n static int foo (lua_State *L) {\n int n = lua_gettop(L); /* number of arguments */\n lua_Number sum = 0;\n int i;\n for (i = 1; i <= n; i++) {\n if (!lua_isnumber(L, i)) {\n lua_pushstring(L, "incorrect argument");\n lua_error(L);\n }\n sum += lua_tonumber(L, i);\n }\n lua_pushnumber(L, sum/n); /* first result */\n lua_pushnumber(L, sum); /* second result */\n return 2; /* number of results */\n }\n
-lua_checkstack lua_checkstack(lua_State *L, int extra) [int]\nEnsures that there are at least `extra` free stack slots in the stack.\nIt returns false if it cannot grow the stack to that size. This function\nnever shrinks the stack; if the stack is already larger than the new size,\nit is left unchanged.\n
-lua_close lua_close(lua_State *L) [void]\nDestroys all objects in the given Lua state (calling the corresponding\ngarbage-collection metamethods, if any) and frees all dynamic memory used by\nthis state. On several platforms, you may not need to call this function,\nbecause all resources are naturally released when the host program ends.\nOn the other hand, long-running programs, such as a daemon or a web server,\nmight need to release states as soon as they are not needed, to avoid growing\ntoo large.\n
-lua_concat lua_concat(lua_State *L, int n) [void]\nConcatenates the `n` values at the top of the stack, pops them, and leaves\nthe result at the top. If `n` is 1, the result is the single value on the\nstack (that is, the function does nothing); if `n` is 0, the result is the\nempty string. Concatenation is performed following the usual semantics of\nLua (see §2.5.4).\n
-lua_cpcall lua_cpcall(lua_State *L, lua_CFunction func, void *ud) [int]\nCalls the C function `func` in protected mode. `func` starts with only one\nelement in its stack, a light userdata containing `ud`. In case of errors,\n`lua_cpcall` returns the same error codes as `lua_pcall`, plus the error\nobject on the top of the stack; otherwise, it returns zero, and does not\nchange the stack. All values returned by `func` are discarded.\n
-lua_createtable lua_createtable(lua_State *L, int narr, int nrec) [void]\nCreates a new empty table and pushes it onto the stack. The new table has\nspace pre-allocated for `narr` array elements and `nrec` non-array elements.\nThis pre-allocation is useful when you know exactly how many elements the\ntable will have. Otherwise you can use the function `lua_newtable`.\n
+lua_checkstack lua_checkstack(lua_State *L, int extra) [int]\nEnsures that there are at least `extra` free stack slots in the stack.\nIt returns false if it cannot fulfill the request, because it would cause the\nstack to be larger than a fixed maximum size (typically at least a few thousand\nelements) or because it cannot allocate memory for the new stack size. This\nfunction never shrinks the stack; if the stack is already larger than the new\nsize, it is left unchanged.\n
+lua_close lua_close(lua_State *L) [void]\nDestroys all objects in the given Lua state (calling the corresponding\ngarbage-collection metamethods, if any) and frees all dynamic memory used by\nthis state. On several platforms, you may not need to call this function,\nbecause all resources are naturally released when the host program ends.\nOn the other hand, long-running programs that create multiple states, such as\ndaemons or web servers, might need to close states as soon as they are not\nneeded.\n
+lua_compare lua_compare(lua_State *L, int index1, int index2, int op) [int]\nCompares two Lua values.\nReturns 1 if the value at acceptable index `index1` satisfies `op` when compared\nwith the value at acceptable index `index2`, following the semantics of the\ncorresponding Lua operator (that is, it may call metamethods). Otherwise\nreturns 0. Also returns 0 if any of the indices is non valid.\n\nThe value of `op` must be one of the following constants:\n * LUA_OPEQ: compares for equality (`==`)\n * LUA_OPLT: compares for less than (`<`)\n * LUA_OPLE: compares for less or equal (`<=`)\n
+lua_concat lua_concat(lua_State *L, int n) [void]\nConcatenates the `n` values at the top of the stack, pops them, and leaves\nthe result at the top. If `n` is 1, the result is the single value on the\nstack (that is, the function does nothing); if `n` is 0, the result is the\nempty string. Concatenation is performed following the usual semantics of\nLua (see §3.4.5).\n
+lua_copy lua_copy(lua_State *L, int fromidx, int toidx) [void]\nMoves the element at the valid index `fromidx` into the valid index `toidx`\nwithout shifting any element (therefore replacing the value at that position).\n
+lua_createtable lua_createtable(lua_State *L, int narr, int nrec) [void]\nCreates a new empty table and pushes it onto the stack. Parameter `narr` is a\nhint for how many elements the table will have as a sequence; parameter `nrec`\nis a hint for how many other elements the table will have. Lua may use these\nhints to preallocate memory for the new table. This pre-allocation is useful for\nperformance when you know in advance how many elements the table will have.\nOtherwise you can use the function `lua_newtable`.\n
lua_dump lua_dump(lua_State *L, lua_Writer writer, void *data) [int]\nDumps a function as a binary chunk. Receives a Lua function on the top of\nthe stack and produces a binary chunk that, if loaded again, results in a\nfunction equivalent to the one dumped. As it produces parts of the chunk,\n`lua_dump` calls function `writer` (see `lua_Writer`) with the given `data`\nto write them.\n\nThe value returned is the error code returned by the last call to the writer;\n0 means no errors.\n\nThis function does not pop the Lua function from the stack.\n
-lua_equal lua_equal(lua_State *L, int index1, int index2) [int]\nReturns 1 if the two values in acceptable indices `index1` and `index2`\nare equal, following the semantics of the Lua `==` operator (that is,\nmay call metamethods). Otherwise returns 0. Also returns 0 if any of the\nindices is non valid.\n
-lua_error lua_error(lua_State *L) [int]\nGenerates a Lua error. The error message (which can actually be a Lua value\nof any type) must be on the stack top. This function does a long jump,\nand therefore never returns. (see `luaL_error`).\n
-lua_gc lua_gc(lua_State *L, int what, int data) [int]\nControls the garbage collector.\n\nThis function performs several tasks, according to the value of the parameter\n`what`:\n * LUA_GCSTOP: stops the garbage collector.\n * LUA_GCRESTART: restarts the garbage collector.\n * LUA_GCCOLLECT: performs a full garbage-collection cycle.\n * LUA_GCCOUNT: returns the current amount of memory (in Kbytes) in use by Lua.\n * LUA_GCCOUNTB: returns the remainder of dividing the current amount of bytes \n of memory in use by Lua by 1024.\n * LUA_GCSTEP: performs an incremental step of garbage collection.\n The step "size" is controlled by `data` (larger values mean more steps)\n in a non-specified way. If you want to control the step size you must\n experimentally tune the value of `data`. The function returns 1 if the\n step finished a garbage-collection cycle.\n * LUA_GCSETPAUSE: sets `data` as the new value for the _pause_ of the \n collector (see §2.10). The function returns the previous value of the \n pause.\n * LUA_GCSETSTEPMUL: sets `data` as the new value for the _step multiplier_ of\n the collector (see §2.10). The function returns the previous value of the \n step multiplier.\n
+lua_error lua_error(lua_State *L) [int]\nGenerates a Lua error. The error message (which can actually be a Lua value\nof any type) must be on the stack top. This function does a long jump,\nand therefore never returns (see `luaL_error`).\n
+lua_gc lua_gc(lua_State *L, int what, int data) [int]\nControls the garbage collector.\n\nThis function performs several tasks, according to the value of the parameter\n`what`:\n * LUA_GCSTOP: stops the garbage collector.\n * LUA_GCRESTART: restarts the garbage collector.\n * LUA_GCCOLLECT: performs a full garbage-collection cycle.\n * LUA_GCCOUNT: returns the current amount of memory (in Kbytes) in use by Lua.\n * LUA_GCCOUNTB: returns the remainder of dividing the current amount of bytes\n of memory in use by Lua by 1024.\n * LUA_GCSTEP: performs an incremental step of garbage collection.\n The step "size" is controlled by `data` (larger values mean more steps)\n in a non-specified way. If you want to control the step size you must\n experimentally tune the value of `data`. The function returns 1 if the\n step finished a garbage-collection cycle.\n * LUA_GCSETPAUSE: sets `data` as the new value for the _pause_ of the\n collector (see §2.5). The function returns the previous value of the\n pause.\n * LUA_GCSETSTEPMUL: sets `data` as the new value for the _step multiplier_ of\n the collector (see §2.5). The function returns the previous value of the\n step multiplier.\n * LUA_GCISRUNNING: returns a boolean that tells whether the collector is\n running (i.e., not stopped).\n * LUA_GCGEN: changes the collector to generational mode (see §2.5).\n * LUA_GCINC: changes the collector to incremental mode. This is the default\n mode.\n\nFor more details about these options, see `collectgarbage`.\n
lua_getallocf lua_getallocf(lua_State *L, void **ud) [lua_Alloc]\nReturns the memory-allocation function of a given state. If `ud` is not\n`NULL`, Lua stores in `*ud` the opaque pointer passed to `lua_newstate`.\n
-lua_getfenv lua_getfenv(lua_State *L, int index) [void]\nPushes onto the stack the environment table of the value at the given index.\n
-lua_getfield lua_getfield(lua_State *L, int index, const char *k) [void]\nPushes onto the stack the value `t[k]`, where `t` is the value at the given\nvalid index. As in Lua, this function may trigger a metamethod for the\n"index" event (see §2.8).\n
-lua_getglobal lua_getglobal(lua_State *L, const char *name) [void]\n\nPushes onto the stack the value of the global `name`. It is defined as\na macro:\n\n #define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, s)\n
-lua_getmetatable lua_getmetatable(lua_State *L, int index) [int]\nPushes onto the stack the metatable of the value at the given acceptable index.\nIf the index is not valid, or if the value does not have a metatable, the\nfunction returns 0 and pushes nothing on the stack.\n
-lua_gettable lua_gettable(lua_State *L, int index) [void]\nPushes onto the stack the value `t[k]`, where `t` is the value at the given\nvalid index and `k` is the value at the top of the stack.\n\nThis function pops the key from the stack (putting the resulting value\nin its place). As in Lua, this function may trigger a metamethod for the\n"index" event (see §2.8).\n
+lua_getctx lua_getctx(lua_State *L, int *ctx) [int]\nThis function is called by a continuation function (see §4.7) to retrieve the\nstatus of the thread and a context information.\n\nWhen called in the original function, `lua_getctx` always returns `LUA_OK` and\ndoes not change the value of its argument `ctx`. When called inside a\ncontinuation function, `lua_getctx` returns `LUA_YIELD` and sets the value of\n`ctx` to be the context information (the value passed as the `ctx` argument to\nthe callee together with the continuation function).\n\nWhen the callee is `lua_pcallk`, Lua may also call its continuation function to\nhandle errors during the call. That is, upon an error in the function called by\n`lua_pcallk`, Lua may not return to the original function but instead may call\nthe continuation function. In that case, a call to `lua_getctx` will return the\nerror code (the value that would be returned by `lua_pcallk`); the value of\n`ctx` will be set to the context information, as in the case of a yield.\n
+lua_getfield lua_getfield(lua_State *L, int index, const char *k) [void]\nPushes onto the stack the value `t[k]`, where `t` is the value at the given\nvalid index. As in Lua, this function may trigger a metamethod for the\n"index" event (see §2.4).\n
+lua_getglobal lua_getglobal(lua_State *L, const char *name) [void]\n\nPushes onto the stack the value of the global `name`.\n
+lua_getmetatable lua_getmetatable(lua_State *L, int index) [int]\nPushes onto the stack the metatable of the value at the given acceptable index.\nIf the value does not have a metatable, the function returns 0 and pushes\nnothing on the stack.\n
+lua_gettable lua_gettable(lua_State *L, int index) [void]\nPushes onto the stack the value `t[k]`, where `t` is the value at the given\nvalid index and `k` is the value at the top of the stack.\n\nThis function pops the key from the stack (putting the resulting value\nin its place). As in Lua, this function may trigger a metamethod for the\n"index" event (see §2.4).\n
lua_gettop lua_gettop(lua_State *L) [int]\nReturns the index of the top element in the stack. Because indices start\nat 1, this result is equal to the number of elements in the stack (and so\n0 means an empty stack).\n
+lua_getuservalue lua_getuservalue(lua_State *L, int index) [void]\nPushes onto the stack the Lua value associated with the userdata at the given\nindex. This Lua value must be a table or nil.\n
lua_insert lua_insert(lua_State *L, int index) [void]\nMoves the top element into the given valid index, shifting up the elements\nabove this index to open space. Cannot be called with a pseudo-index,\nbecause a pseudo-index is not an actual stack position.\n
-lua_Integer lua_Integer [ptrdiff_t]\nThe type used by the Lua API to represent integral values.\n\nBy default it is a `ptrdiff_t`, which is usually the largest signed integral\ntype the machine handles "comfortably".\n
-lua_isboolean lua_isboolean(lua_State *L, int index) [int]\nReturns 1 if the value at the given acceptable index has type boolean,\nand 0 otherwise.\n
+lua_Integer lua_Integer [ptrdiff_t]\nThe type used by the Lua API to represent signed integral values.\n\nBy default it is a `ptrdiff_t`, which is usually the largest signed integral\ntype the machine handles "comfortably".\n
+lua_isboolean lua_isboolean(lua_State *L, int index) [int]\nReturns 1 if the value at the given acceptable index is a boolean, and 0\notherwise.\n
lua_iscfunction lua_iscfunction(lua_State *L, int index) [int]\nReturns 1 if the value at the given acceptable index is a C function,\nand 0 otherwise.\n
lua_isfunction lua_isfunction(lua_State *L, int index) [int]\nReturns 1 if the value at the given acceptable index is a function (either\nC or Lua), and 0 otherwise.\n
lua_islightuserdata lua_islightuserdata(lua_State *L, int index) [int]\n\nReturns 1 if the value at the given acceptable index is a light userdata,\nand 0 otherwise.\n
@@ -32,120 +36,151 @@ lua_isstring lua_isstring (lua_State *L, int index) [int]\nReturns 1 if the valu
lua_istable lua_istable(lua_State *L, int index) [int]\nReturns 1 if the value at the given acceptable index is a table, and 0\notherwise.\n
lua_isthread lua_isthread(lua_State *L, int index) [int]\nReturns 1 if the value at the given acceptable index is a thread, and\n0 otherwise.\n
lua_isuserdata lua_isuserdata(lua_State *L, int index) [int]\nReturns 1 if the value at the given acceptable index is a userdata (either\nfull or light), and 0 otherwise.\n
-lua_lessthan lua_lessthan(lua_State *L, int index1, int index2) [int]\nReturns 1 if the value at acceptable index `index1` is smaller than the\nvalue at acceptable index `index2`, following the semantics of the Lua `<`\noperator (that is, may call metamethods). Otherwise returns 0. Also returns\n0 if any of the indices is non valid.\n
-lua_load lua_load(lua_State *L, lua_Reader reader, void *data, const char *chunkname) [int]\nLoads a Lua chunk. If there are no errors, `lua_load` pushes the compiled\nchunk as a Lua function on top of the stack. Otherwise, it pushes an error\nmessage. The return values of `lua_load` are:\n * 0: no errors;\n * LUA_ERRSYNTAX: syntax error during pre-compilation;\n * LUA_ERRMEM: memory allocation error.\nThis function only loads a chunk; it does not run it.\n\n`lua_load` automatically detects whether the chunk is text or binary, and\nloads it accordingly (see program `luac`).\n\nThe `lua_load` function uses a user-supplied `reader` function to read the\nchunk (see `lua_Reader`). The `data` argument is an opaque value passed to\nthe reader function.\n\nThe `chunkname` argument gives a name to the chunk, which is used for error\nmessages and in debug information (see §3.8).\n
-lua_newstate lua_newstate(lua_Alloc f, void *ud) [lua_State*]\nCreates a new, independent state. Returns `NULL` if cannot create the state\n(due to lack of memory). The argument `f` is the allocator function; Lua\ndoes all memory allocation for this state through this function. The second\nargument, `ud`, is an opaque pointer that Lua simply passes to the allocator\nin every call.\n
+lua_len lua_len(lua_State *L, int index) [void]\nReturns the "length" of the value at the given acceptable index; it is\nequivalent to the '`#`' operator in Lua (see §3.4.6). The result is pushed on\nthe stack.\n
+lua_load lua_load(lua_State *L, lua_Reader reader, void *data, const char *source, const char *mode) [int]\nLoads a Lua chunk (without running it). If there are no errors, `lua_load`\npushes the compiled chunk as a Lua function on top of the stack. Otherwise, it\npushes an error message.\n\nThe return values of `lua_load` are:\n * LUA_OK: no errors;\n * LUA_ERRSYNTAX: syntax error during pre-compilation;\n * LUA_ERRMEM: memory allocation error.\n * LUA_ERRGCMM: error while running a `__gc` metamethod. (This error has no\n relation with the chunk being loaded. It is generated by the garbage\n collector.)\n\nThe `lua_load` function uses a user-supplied `reader` function to read the chunk\n(see `lua_Reader`). The `data` argument is an opaque value passed to the reader\nfunction.\n\nThe `source` argument gives a name to the chunk, which is used for error\nmessages and in debug information (see §4.9).\n\n`lua_load` automatically detects whether the chunk is text or binary and loads\nit accordingly (see program `luac`). The string `mode` works as in function\n`load`, with the addition that a `NULL` value is equivalent to the string\n"`bt`".\n\nIf the resulting function has one upvalue, this upvalue is set to the value of\nthe global environment stored at index `LUA_RIDX_GLOBALS` in the registry\n(see §4.5). When loading main chunks, this upvalue will be the `_ENV` variable\n(see §2.2).\n
+lua_newstate lua_newstate(lua_Alloc f, void *ud) [lua_State*]\nCreates a new thread running in a new, independent state. Returns `NULL` if\ncannot create the thread or the state (due to lack of memory). The argument `f`\nis the allocator function; Lua does all memory allocation for this state through\nthis function. The second argument, `ud`, is an opaque pointer that Lua passes\nto the allocator in every call.\n
lua_newtable lua_newtable(lua_State *L) [void]\nCreates a new empty table and pushes it onto the stack. It is equivalent to\n`lua_createtable(L, 0, 0)`.\n
-lua_newthread lua_newthread(lua_State *L) [lua_State*]\nCreates a new thread, pushes it on the stack, and returns a pointer to a\n`lua_State` that represents this new thread. The new state returned by this\nfunction shares with the original state all global objects (such as tables),\nbut has an independent execution stack.\n\nThere is no explicit function to close or to destroy a thread. Threads are\nsubject to garbage collection, like any Lua object.\n
-lua_newuserdata lua_newuserdata(lua_State *L, size_t size) [void*]\nThis function allocates a new block of memory with the given size, pushes onto\nthe stack a new full userdata with the block address, and returns this address.\n\nUserdata represent C values in Lua. A _full userdata_ represents a block\nof memory. It is an object (like a table): you must create it, it can have\nits own metatable, and you can detect when it is being collected. A full\nuserdata is only equal to itself (under raw equality).\n\nWhen Lua collects a full userdata with a `gc` metamethod, Lua calls the\nmetamethod and marks the userdata as finalized. When this userdata is\ncollected again then Lua frees its corresponding memory.\n
-lua_next lua_next(lua_State *L, int index) [int]\n\nPops a key from the stack, and pushes a key-value pair from the table at\nthe given index (the "next" pair after the given key). If there are no more\nelements in the table, then `lua_next` returns 0 (and pushes nothing).\n\nA typical traversal looks like this:\n\n /* table is in the stack at index 't' */\n lua_pushnil(L); /* first key */\n while (lua_next(L, t) != 0) {\n /* uses 'key' (at index -2) and 'value' (at index -1) */\n printf("%s - %s\n",\n lua_typename(L, lua_type(L, -2)),\n lua_typename(L, lua_type(L, -1)));\n /* removes 'value'; keeps 'key' for next iteration */\n lua_pop(L, 1);\n }\n\nWhile traversing a table, do not call `lua_tolstring` directly on a key, unless\nyou know that the key is actually a string. Recall that `lua_tolstring`\n_changes_ the value at the given index; this confuses the next call to\n`lua_next`.\n
-lua_Number lua_Number [double]\nThe type of numbers in Lua. By default, it is double, but that can be\nchanged in `luaconf.h`.\n\nThrough the configuration file you can change Lua to operate with another\ntype for numbers (e.g., float or long).\n
-lua_objlen lua_objlen(lua_State *L, int index) [size_t]\nReturns the "length" of the value at the given acceptable index: for strings,\nthis is the string length; for tables, this is the result of the length\noperator ('#'); for userdata, this is the size of the block of memory allocated \nfor the userdata; for other values, it is 0.\n
-lua_pcall lua_pcall(lua_State *L, int nargs, int nresults, int errfunc) [int]\nCalls a function in protected mode.\n\nBoth `nargs` and `nresults` have the same meaning as in `lua_call`. If there\nare no errors during the call, `lua_pcall` behaves exactly like `lua_call`.\nHowever, if there is any error,\n\n`lua_pcall` catches it, pushes a single value on the stack (the error message),\nand returns an error code. Like `lua_call`, `lua_pcall` always removes the\nfunction and its arguments from the stack.\n\nIf `errfunc` is 0, then the error message returned on the stack is exactly\nthe original error message. Otherwise, `errfunc` is the stack index of an\n_error handler function_. (In the current implementation, this index cannot\nbe a pseudo-index.) In case of runtime errors, this function will be called\nwith the error message and its return value will be the message returned on\nthe stack by `lua_pcall`.\n\nTypically, the error handler function is used to add more debug information\nto the error message, such as a stack traceback. Such information cannot be\ngathered after the return of `lua_pcall`, since by then the stack has unwound.\n\nThe `lua_pcall` function returns 0 in case of success or one of the following\nerror codes (defined in `lua.h`):\n * LUA_ERRRUN: a runtime error.\n * LUA_ERRMEM: memory allocation error. For such errors, Lua does not call the \n error handler function.\n * LUA_ERRERR: error while running the error handler function.\n\n \nlua_pop lua_pop(lua_State *L, int n) [void]\nPops `n` elements from the stack.\n
+lua_newthread lua_newthread(lua_State *L) [lua_State*]\nCreates a new thread, pushes it on the stack, and returns a pointer to a\n`lua_State` that represents this new thread. The new thread returned by this\nfunction shares with the original thread its global environment, but has an\nindependent execution stack.\n\nThere is no explicit function to close or to destroy a thread. Threads are\nsubject to garbage collection, like any Lua object.\n
+lua_newuserdata lua_newuserdata(lua_State *L, size_t size) [void*]\nThis function allocates a new block of memory with the given size, pushes onto\nthe stack a new full userdata with the block address, and returns this address.\nThe host program can freely use this memory.\n
+lua_next lua_next(lua_State *L, int index) [int]\n\nPops a key from the stack, and pushes a key-value pair from the table at\nthe given index (the "next" pair after the given key). If there are no more\nelements in the table, then `lua_next` returns 0 (and pushes nothing).\n\nA typical traversal looks like this:\n\n /* table is in the stack at index 't' */\n lua_pushnil(L); /* first key */\n while (lua_next(L, t) != 0) {\n /* uses 'key' (at index -2) and 'value' (at index -1) */\n printf("%s - %s\n",\n lua_typename(L, lua_type(L, -2)),\n lua_typename(L, lua_type(L, -1)));\n /* removes 'value'; keeps 'key' for next iteration */\n lua_pop(L, 1);\n }\n\nWhile traversing a table, do not call `lua_tolstring` directly on a key, unless\nyou know that the key is actually a string. Recall that `lua_tolstring` may\nchange the value at the given index; this confuses the next call to `lua_next`.\n\nSee function `next` for the caveats of modifying the table during its traversal.\n
+lua_Number lua_Number [double]\nThe type of numbers in Lua. By default, it is double, but that can be\nchanged in `luaconf.h`. Through the configuration file you can change Lua to\noperate with another type for numbers (e.g., float or long).\n
+lua_pcall lua_pcall(lua_State *L, int nargs, int nresults, int msgh) [int]\nCalls a function in protected mode.\n\nBoth `nargs` and `nresults` have the same meaning as in `lua_call`. If there\nare no errors during the call, `lua_pcall` behaves exactly like `lua_call`.\nHowever, if there is any error,\n\n`lua_pcall` catches it, pushes a single value on the stack (the error message),\nand returns an error code. Like `lua_call`, `lua_pcall` always removes the\nfunction and its arguments from the stack.\n\nIf `msgh` is 0, then the error message returned on the stack is exactly the\noriginal error message. Otherwise, `msgh` is the stack index of a _message\nhandler_. (In the current implementation, this index cannot be a pseudo-index.)\nIn case of runtime errors, this function will be called with the error message\nand its return value will be the message returned on the stack by `lua_pcall`.\n\nTypically, the message handler is used to add more debug information to the\nerror message, such as a stack traceback. Such information cannot be gathered\nafter the return of `lua_pcall`, since by then the stack has unwound.\n\nThe `lua_pcall` function returns one of the following codes (defined in\n`lua.h`):\n * LUA_OK (0): success.\n * LUA_ERRRUN: a runtime error.\n * LUA_ERRMEM: memory allocation error. For such errors, Lua does not call the\n message handler.\n * LUA_ERRERR: error while running the message handler.\n * LUA_ERRGCMM: error while running a `__gc` metamethod. (This error typically\n has no relation with the function being called. It is generated by the\n garbage collector.)\n
+lua_pcallk lua_pcallk(lua_State *L, int nargs, int nresults, int errfunc, int ctx, lua_CFunction k) [int]\nThis function behaves exactly like `lua_pcall`, but allows the called function\nto yield (see §4.7).\n
+lua_pop lua_pop(lua_State *L, int n) [void]\nPops `n` elements from the stack.\n
lua_pushboolean lua_pushboolean(lua_State *L, int b) [void]\nPushes a boolean value with value `b` onto the stack.\n
-lua_pushcclosure lua_pushcclosure(lua_State *L, lua_CFunction fn, int n) [void]\nPushes a new C closure onto the stack.\n\nWhen a C function is created, it is possible to associate some values with it,\nthus creating a C closure (see §3.4); these values are then accessible to\nthe function whenever it is called. To associate values with a C function,\nfirst these values should be pushed onto the stack (when there are multiple\nvalues, the first value is pushed first). Then `lua_pushcclosure` is called to\ncreate and push the C function onto the stack, with the argument `n` telling\nhow many values should be associated with the function. `lua_pushcclosure`\nalso pops these values from the stack.\n\nThe maximum value for `n` is 255.\n
-lua_pushcfunction lua_pushcfunction(lua_State *L, lua_CFunction f) [void]\nPushes a C function onto the stack. This function receives a pointer to a\nC function and pushes onto the stack a Lua value of type `function` that,\nwhen called, invokes the corresponding C function.\n\nAny function to be registered in Lua must follow the correct protocol to\nreceive its parameters and return its results (see `lua_CFunction`).\n\n`lua_pushcfunction` is defined as a macro:\n\n #define lua_pushcfunction(L,f) lua_pushcclosure(L,f,0)\n
-lua_pushfstring lua_pushfstring(lua_State *L, const char *fmt, ...) [const char*]\n\nPushes onto the stack a formatted string and returns a pointer to this string.\nIt is similar to the C function `sprintf`, but has some important differences:\n * You do not have to allocate space for the result: the result is a\n Lua string and Lua takes care of memory allocation (and deallocation,\n through garbage collection).\n * The conversion specifiers are quite restricted. There are no flags,\n widths, or precisions. The conversion specifiers can only be '%%'\n (inserts a '%' in the string), '%s' (inserts a zero-terminated string,\n with no size restrictions), '%f' (inserts a `lua_Number`), '%p' (inserts\n a pointer as a hexadecimal numeral), '%d' (inserts an `int`), and '%c'\n (inserts an `int` as a character).\n
+lua_pushcclosure lua_pushcclosure(lua_State *L, lua_CFunction fn, int n) [void]\nPushes a new C closure onto the stack.\n\nWhen a C function is created, it is possible to associate some values with it,\nthus creating a C closure (see §4.4); these values are then accessible to\nthe function whenever it is called. To associate values with a C function,\nfirst these values should be pushed onto the stack (when there are multiple\nvalues, the first value is pushed first). Then `lua_pushcclosure` is called to\ncreate and push the C function onto the stack, with the argument `n` telling\nhow many values should be associated with the function. `lua_pushcclosure`\nalso pops these values from the stack.\n\nThe maximum value for `n` is 255.\n\nWhen `n` is zero, this function creates a _light C function_, which is just a\npointer to the C function. In that case, it never throws a memory error.\n
+lua_pushcfunction lua_pushcfunction(lua_State *L, lua_CFunction f) [void]\nPushes a C function onto the stack. This function receives a pointer to a\nC function and pushes onto the stack a Lua value of type `function` that,\nwhen called, invokes the corresponding C function.\n\nAny function to be registered in Lua must follow the correct protocol to\nreceive its parameters and return its results (see `lua_CFunction`).\n\n`lua_pushcfunction` is defined as a macro:\n\n #define lua_pushcfunction(L,f) lua_pushcclosure(L,f,0)\nNote that `f` is used twice.\n
+lua_pushfstring lua_pushfstring(lua_State *L, const char *fmt, ...) [const char*]\nPushes onto the stack a formatted string and returns a pointer to this string.\nIt is similar to the C function `sprintf`, but has some important differences:\n * You do not have to allocate space for the result: the result is a\n Lua string and Lua takes care of memory allocation (and deallocation,\n through garbage collection).\n * The conversion specifiers are quite restricted. There are no flags,\n widths, or precisions. The conversion specifiers can only be '%%'\n (inserts a '%' in the string), '%s' (inserts a zero-terminated string,\n with no size restrictions), '%f' (inserts a `lua_Number`), '%p' (inserts\n a pointer as a hexadecimal numeral), '%d' (inserts an `int`), and '%c'\n (inserts an `int` as a byte).\n
lua_pushinteger lua_pushinteger(lua_State *L, lua_Integer n) [void]\nPushes a number with value `n` onto the stack.\n
-lua_pushlightuserdata lua_pushlightuserdata(lua_State *L, void *p) [void]\nPushes a light userdata onto the stack.\n\nUserdata represent C values in Lua. A _light userdata_ represents a pointer.\nIt is a value (like a number): you do not create it, it has no individual\nmetatable, and it is not collected (as it was never created). A light\nuserdata is equal to "any" light userdata with the same C address.\n
-lua_pushliteral lua_pushliteral(lua_State *L, const char *s) [void]\nThis macro is equivalent to `lua_pushlstring`, but can be used only when `s` is\na literal string. In these cases, it automatically provides the string length.\n
-lua_pushlstring lua_pushlstring(lua_State *L, const char *s, size_t len) [void]\nPushes the string pointed to by `s` with size `len` onto the stack. Lua makes\n(or reuses) an internal copy of the given string, so the memory at `s` can\nbe freed or reused immediately after the function returns. The string can\ncontain embedded zeros.\n
+lua_pushlightuserdata lua_pushlightuserdata(lua_State *L, void *p) [void]\nPushes a light userdata onto the stack.\n\nUserdata represent C values in Lua. A _light userdata_ represents a pointer, a\n`void*`. It is a value (like a number): you do not create it, it has no\nindividual metatable, and it is not collected (as it was never created). A\nlight userdata is equal to "any" light userdata with the same C address.\n
+lua_pushliteral lua_pushliteral(lua_State *L, const char *s) [const char*]\nThis macro is equivalent to `lua_pushlstring`, but can be used only when `s` is\na literal string. It automatically provides the string length.\n
+lua_pushlstring lua_pushlstring(lua_State *L, const char *s, size_t len) [const char*]\nPushes the string pointed to by `s` with size `len` onto the stack. Lua makes\n(or reuses) an internal copy of the given string, so the memory at `s` can\nbe freed or reused immediately after the function returns. The string can\ncontain any binary data, including embedded zeros.\n\nReturns a pointer to the internal copy of the string.\n
lua_pushnil lua_pushnil(lua_State *L) [void]\nPushes a nil value onto the stack.\n
lua_pushnumber lua_pushnumber(lua_State *L, lua_Number n) [void]\nPushes a number with value `n` onto the stack.\n
-lua_pushstring lua_pushstring(lua_State *L, const char *s) [void]\nPushes the zero-terminated string pointed to by `s` onto the stack. Lua makes\n(or reuses) an internal copy of the given string, so the memory at `s`\ncan be freed or reused immediately after the function returns. The string\ncannot contain embedded zeros; it is assumed to end at the first zero.\n
+lua_pushstring lua_pushstring(lua_State *L, const char *s) [const char*]\nPushes the zero-terminated string pointed to by `s` onto the stack. Lua makes\n(or reuses) an internal copy of the given string, so the memory at `s`\ncan be freed or reused immediately after the function returns. The string\ncannot contain embedded zeros; it is assumed to end at the first zero.\n\nReturns a pointer to the internal copy of the string.\n\nIf `s` is `NULL`, pushes nil and returns `NULL`.\n
lua_pushthread lua_pushthread(lua_State *L) [int]\nPushes the thread represented by `L` onto the stack. Returns 1 if this\nthread is the main thread of its state.\n
lua_pushvalue lua_pushvalue(lua_State *L, int index) [void]\nPushes a copy of the element at the given valid index onto the stack.\n
lua_pushvfstring lua_pushvfstring(lua_State *L, const char *fmt, va_list argp) [const char*]\nEquivalent to `lua_pushfstring`, except that it receives a `va_list` instead\nof a variable number of arguments.\n
lua_rawequal lua_rawequal(lua_State *L, int index1, int index2) [int]\nReturns 1 if the two values in acceptable indices `index1` and `index2` are\nprimitively equal (that is, without calling metamethods). Otherwise returns 0.\nAlso returns 0 if any of the indices are non valid.\n
lua_rawget lua_rawget(lua_State *L, int index) [void]\nSimilar to `lua_gettable`, but does a raw access (i.e., without metamethods).\n
-lua_rawgeti lua_rawgeti(lua_State *L, int index, int n) [void]\nPushes onto the stack the value `t[n]`, where `t` is the value at the given\nvalid index. The access is raw; that is, it does not invoke metamethods.\n
+lua_rawgeti lua_rawgeti(lua_State *L, int index, int n) [void]\nPushes onto the stack the value `t[n]`, where `t` is the table at the given\nvalid index. The access is raw; that is, it does not invoke metamethods.\n
+lua_rawgetp lua_rawgetp(lua_State *L, int index, const void *p) [void]\nPushes onto the stack the value `t[k]`, where `t` is the table at the given\nvalid index and `k` is the pointer `p` represented as a light userdata. The\naccess is raw; that is, it does not invoke metamethods.\n
+lua_rawlen lua_rawlen(lua_State *L, int index) [size_t]\nReturns the raw "length" of the value at the given acceptable index: for\nstrings, this is the string length; for tables, this is the result of the length\noperator ('`#`') with no metamethods; for userdata, this is the size of the\nblock of memory allocated for the userdata; for other values, it is 0.\n
lua_rawset lua_rawset(lua_State *L, int index) [void]\nSimilar to `lua_settable`, but does a raw assignment (i.e., without\nmetamethods).\n
-lua_rawseti lua_rawseti(lua_State *L, int index, int n) [void]\nDoes the equivalent of `t[n] = v`, where `t` is the value at the given valid\nindex and `v` is the value at the top of the stack.\n\nThis function pops the value from the stack. The assignment is raw; that is,\nit does not invoke metamethods.\n
+lua_rawseti lua_rawseti(lua_State *L, int index, int n) [void]\nDoes the equivalent of `t[n] = v`, where `t` is the table at the given valid\nindex and `v` is the value at the top of the stack.\n\nThis function pops the value from the stack. The assignment is raw; that is, it\ndoes not invoke metamethods.\n
+lua_rawsetp lua_rawsetp(lua_State *L, int index, const void *p) [void]\nDoes the equivalent of `t[k] = v`, where `t` is the table at the given valid\nindex, `k` is the pointer `p` represented as a light userdata, and `v` is the\nvalue at the top of the stack.\n\nThis function pops the value from the stack. The assignment is raw; that is, it\ndoes not invoke metamethods.\n
lua_Reader (*lua_Reader)(lua_State *L, void *data, size_t *size) [const char*]\nThe reader function used by `lua_load`. Every time it needs another piece of\nthe chunk, `lua_load` calls the reader, passing along its `data` parameter.\nThe reader must return a pointer to a block of memory with a new piece of\nthe chunk and set `size` to the block size. The block must exist until the\nreader function is called again. To signal the end of the chunk, the reader\nmust return `NULL` or set `size` to zero. The reader function may return\npieces of any size greater than zero.\n
lua_register lua_register(lua_State *L, const char *name, lua_CFunction f) [void]\nSets the C function `f` as the new value of global `name`. It is defined\nas a macro:\n\n #define lua_register(L,n,f) (lua_pushcfunction(L, f), lua_setglobal(L, n))\n
lua_remove lua_remove(lua_State *L, int index) [void]\nRemoves the element at the given valid index, shifting down the elements\nabove this index to fill the gap. Cannot be called with a pseudo-index,\nbecause a pseudo-index is not an actual stack position.\n
-lua_replace lua_replace(lua_State *L, int index) [void]\nMoves the top element into the given position (and pops it), without shifting\nany element (therefore replacing the value at the given position).\n
-lua_resume lua_resume(lua_State *L, int narg) [int]\nStarts and resumes a coroutine in a given thread.\n\nTo start a coroutine, you first create a new thread (see `lua_newthread`); then\nyou push onto its stack the main function plus any arguments; then you call\n`lua_resume`, with `narg` being the number of arguments. This call returns\nwhen the coroutine suspends or finishes its execution. When it returns, the\nstack contains all values passed to `lua_yield`, or all values returned by\nthe body function. `lua_resume` returns `LUA_YIELD` if the coroutine yields,\n0 if the coroutine finishes its execution without errors, or an error code\nin case of errors (see `lua_pcall`). In case of errors, the stack is not\nunwound, so you can use the debug API over it. The error message is on the\ntop of the stack. To restart a coroutine, you put on its stack only the\nvalues to be passed as results from `yield`, and then call `lua_resume`.\n
+lua_replace lua_replace(lua_State *L, int index) [void]\nMoves the top element into the given position, without shifting any element\n(therefore replacing the value at the given position), and then pops the top\nelement.\n
+lua_resume lua_resume(lua_State *L, lua_State *from, int narg) [int]\nStarts and resumes a coroutine in a given thread.\n\nTo start a coroutine, you push onto the thread stack the main function plus any\narguments; then you call `lua_resume`, with `narg` being the number of\narguments. This call returns when the coroutine suspends or finishes its\nexecution. When it returns, the stack contains all values passed to\n`lua_yield`, or all values returned by the body function. `lua_resume` returns\n`LUA_YIELD` if the coroutine yields, `LUA_OK` if the coroutine finishes its\nexecution without errors, or an error code in case of errors (see `lua_pcall`).\n\nIn case of errors, the stack is not unwound, so you can use the debug API over\nit. The error message is on the top of the stack.\n\nTo resume a coroutine, you put on its stack only the values to be passed as\nresults from `yield`, and then call `lua_resume`.\n
lua_setallocf lua_setallocf(lua_State *L, lua_Alloc f, void *ud) [void]\nChanges the allocator function of a given state to `f` with user data `ud`.\n
-lua_setfenv lua_setfenv(lua_State *L, int index) [int]\nPops a table from the stack and sets it as the new environment for the value\nat the given index. If the value at the given index is neither a function\nnor a thread nor a userdata, `lua_setfenv` returns 0. Otherwise it returns 1.\n
-lua_setfield lua_setfield(lua_State *L, int index, const char *k) [void]\nDoes the equivalent to `t[k] = v`, where `t` is the value at the given valid\nindex and `v` is the value at the top of the stack.\n\nThis function pops the value from the stack. As in Lua, this function may\ntrigger a metamethod for the "newindex" event (see §2.8).\n
-lua_setglobal lua_setglobal(lua_State *L, const char *name) [void]\nPops a value from the stack and sets it as the new value of global `name`.\nIt is defined as a macro:\n\n #define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, s)\n
-lua_setmetatable lua_setmetatable(lua_State *L, int index) [int]\nPops a table from the stack and sets it as the new metatable for the value\nat the given acceptable index.\n
-lua_settable lua_settable(lua_State *L, int index) [void]\nDoes the equivalent to `t[k] = v`, where `t` is the value at the given\nvalid index,\n\n`v` is the value at the top of the stack, and `k` is the value just below\nthe top.\n\nThis function pops both the key and the value from the stack. As in Lua,\nthis function may trigger a metamethod for the "newindex" event (see §2.8).\n
+lua_setfield lua_setfield(lua_State *L, int index, const char *k) [void]\nDoes the equivalent to `t[k] = v`, where `t` is the value at the given valid\nindex and `v` is the value at the top of the stack.\n\nThis function pops the value from the stack. As in Lua, this function may\ntrigger a metamethod for the "newindex" event (see §2.4).\n
+lua_setglobal lua_setglobal(lua_State *L, const char *name) [void]\nPops a value from the stack and sets it as the new value of global `name`.\n
+lua_setmetatable lua_setmetatable(lua_State *L, int index) [void]\nPops a table from the stack and sets it as the new metatable for the value\nat the given acceptable index.\n
+lua_settable lua_settable(lua_State *L, int index) [void]\nDoes the equivalent to `t[k] = v`, where `t` is the value at the given\nvalid index,\n\n`v` is the value at the top of the stack, and `k` is the value just below\nthe top.\n\nThis function pops both the key and the value from the stack. As in Lua,\nthis function may trigger a metamethod for the "newindex" event (see §2.4).\n
lua_settop lua_settop(lua_State *L, int index) [void]\nAccepts any acceptable index, or 0, and sets the stack top to this index.\nIf the new top is larger than the old one, then the new elements are filled\nwith <b>nil</b>. If `index` is 0, then all stack elements are removed.\n
-lua_State lua_State [struct lua_State]\nOpaque structure that keeps the whole state of a Lua interpreter. The Lua\nlibrary is fully reentrant: it has no global variables. All information\nabout a state is kept in this structure.\n\nA pointer to this state must be passed as the first argument to every\nfunction in the library, except to `lua_newstate`, which creates a Lua state\nfrom scratch.\n
-lua_status lua_status(lua_State *L) [int]\nReturns the status of the thread `L`.\n\nThe status can be 0 for a normal thread, an error code if the thread finished\nits execution with an error, or `LUA_YIELD` if the thread is suspended.\n
-lua_toboolean lua_toboolean(lua_State *L, int index) [int]\nConverts the Lua value at the given acceptable index to a C boolean value\n(0 or 1). Like all tests in Lua,\n\n`lua_toboolean` returns 1 for any Lua value different from false and nil;\notherwise it returns 0. It also returns 0 when called with a non-valid index.\n(If you want to accept only actual boolean values, use `lua_isboolean`\nto test the value's type.)\n
+lua_setuservalue lua_setuservalue(lua_State *L, int index) [void]\nPops a table or nil from the stack and sets it as the new value associated to\nthe userdata at the given index.\n
+lua_State lua_State [struct lua_State]\nAn opaque structure that keeps the whole state of a Lua interpreter. The Lua\nlibrary is fully reentrant: it has no global variables. All information\nabout a state is kept in this structure.\n\nA pointer to this state must be passed as the first argument to every\nfunction in the library, except to `lua_newstate`, which creates a Lua state\nfrom scratch.\n
+lua_status lua_status(lua_State *L) [int]\nReturns the status of the thread `L`.\n\nThe status can be 0 (`LUA_OK`) for a normal thread, an error code if the thread\nfinished the execution of a `lua_resume` with an error, or `LUA_YIELD` if the\nthread is suspended.\n\nYou can only call functions in threads with status `LUA_OK`. You can resume\nthreads with status `LUA_OK` (to start a new coroutine) or `LUA_YIELD` (to\nresume a coroutine).\n
+lua_toboolean lua_toboolean(lua_State *L, int index) [int]\nConverts the Lua value at the given acceptable index to a C boolean value\n(0 or 1). Like all tests in Lua, `lua_toboolean` returns true for any Lua value\ndifferent from false and nil; otherwise it returns false. It also returns false\nwhen called with a non-valid index. (If you want to accept only actual boolean\nvalues, use `lua_isboolean` to test the value's type.)\n
lua_tocfunction lua_tocfunction(lua_State *L, int index) [lua_CFunction]\nConverts a value at the given acceptable index to a C function. That value\nmust be a C function; otherwise, returns `NULL`.\n
-lua_tointeger lua_tointeger(lua_State *L, int index) [lua_Integer]\nConverts the Lua value at the given acceptable index to the signed integral\ntype `lua_Integer`. The Lua value must be a number or a string convertible\nto a number (see §2.2.1); otherwise, `lua_tointeger` returns 0.\n\nIf the number is not an integer, it is truncated in some non-specified way.\n
+lua_tointeger lua_tointeger(lua_State *L, int index) [lua_Integer]\nEquivalent to `lua_tointegerx` with `isnum` equal to `NULL`.\n
+lua_tointegerx lua_tointegerx(lua_State *L, int index, int *isnum) [lua_Integer]\nConverts the Lua value at the given acceptable index to the signed integral\ntype `lua_Integer`. The Lua value must be a number or a string convertible\nto a number (see §3.4.2); otherwise, `lua_tointegerx` returns 0.\n\nIf the number is not an integer, it is truncated in some non-specified way.\n\nIf `isnum` is not `NULL`, its referent is assigned a boolean value that\nindicates whether the operation succeeded.\n
lua_tolstring lua_tolstring(lua_State *L, int index, size_t *len) [const char*]\nConverts the Lua value at the given acceptable index to a C string. If `len`\nis not `NULL`, it also sets `*len` with the string length. The Lua value\nmust be a string or a number; otherwise, the function returns `NULL`.\nIf the value is a number, then `lua_tolstring` also _changes the actual\nvalue in the stack to a string_. (This change confuses `lua_next` when\n`lua_tolstring` is applied to keys during a table traversal.)\n\n`lua_tolstring` returns a fully aligned pointer to a string inside the\nLua state. This string always has a zero ('\0') after its last character\n(as in C), but can contain other zeros in its body. Because Lua has garbage\ncollection, there is no guarantee that the pointer returned by `lua_tolstring`\nwill be valid after the corresponding value is removed from the stack.\n
-lua_tonumber lua_tonumber(lua_State *L, int index) [lua_Number]\nConverts the Lua value at the given acceptable index to the C type `lua_Number`\n(see `lua_Number`). The Lua value must be a number or a string convertible\nto a number (see §2.2.1); otherwise, `lua_tonumber` returns 0.\n
+lua_tonumber lua_tonumber(lua_State *L, int index) [lua_Number]\nEquivalent to `lua_tonumberx` with `isnum` equal to `NULL`.\n
+lua_tonumberx lua_tonumberx(lua_State *L, int index, int *isnum) [lua_Number]\nConverts the Lua value at the given acceptable index to the C type `lua_Number`\n(see `lua_Number`). The Lua value must be a number or a string convertible\nto a number (see §3.4.2); otherwise, `lua_tonumberx` returns 0.\n\nIf `isnum` is not `NULL`, its referent is assigned a boolean value that\nindicates whether the operation succeeded.\n
lua_topointer lua_topointer(lua_State *L, int index) [const void*]\nConverts the value at the given acceptable index to a generic C pointer\n(`void*`). The value can be a userdata, a table, a thread, or a function;\notherwise, `lua_topointer` returns `NULL`. Different objects will give\ndifferent pointers. There is no way to convert the pointer back to its\noriginal value.\n\nTypically this function is used only for debug information.\n
lua_tostring lua_tostring(lua_State *L, int index) [const char*]\nEquivalent to `lua_tolstring` with `len` equal to `NULL`.\n
lua_tothread lua_tothread(lua_State *L, int index) [lua_State*]\nConverts the value at the given acceptable index to a Lua thread (represented\nas `lua_State*`). This value must be a thread; otherwise, the function\nreturns `NULL`.\n
+lua_tounsigned lua_tounsigned(lua_State *L, int index) [lua_Unsigned]\nEquivalent to `lua_tounsignedx` with `isnum` equal to `NULL`.\n
+lua_tounsignedx lua_tounsignedx(lua_State *L, int index, int *isnum) [lua_Unsigned]\nConverts the Lua value at the given acceptable index to the unsigned integral\ntype `lua_Unsigned`. The Lua value must be a number or a string convertible to\na number (see §3.4.2); otherwise, `lua_tounsignedx` returns 0.\n\nIf the number is not an integer, it is truncated in some non-specified way.\nIf the number is outside the range of representable values, it is normalized to\nthe remainder of its division by one more than the maximum representable value.\n\nIf `isnum` is not `NULL`, its referent is assigned a boolean value that\nindicates whether the operation succeeded.\n
lua_touserdata lua_touserdata(lua_State *L, int index) [void*]\nIf the value at the given acceptable index is a full userdata, returns\nits block address. If the value is a light userdata, returns its pointer.\nOtherwise, returns `NULL`.\n
-lua_type lua_type(lua_State *L, int index) [int]\nReturns the type of the value in the given acceptable index, or `LUA_TNONE` for\na non-valid index (that is, an index to an "empty" stack position). The types\nreturned by `lua_type` are coded by the following constants defined in `lua.h`:\n`LUA_TNIL`, `LUA_TNUMBER`, `LUA_TBOOLEAN`, `LUA_TSTRING`, `LUA_TTABLE`,\n`LUA_TFUNCTION`, `LUA_TUSERDATA`, `LUA_TTHREAD`, and `LUA_TLIGHTUSERDATA`.\n
+lua_type lua_type(lua_State *L, int index) [int]\nReturns the type of the value in the given acceptable index, or `LUA_TNONE` for\na non-valid index.\n\nThe types returned by `lua_type` are coded by the following constants defined in\n`lua.h`: `LUA_TNIL`, `LUA_TNUMBER`, `LUA_TBOOLEAN`, `LUA_TSTRING`, `LUA_TTABLE`,\n`LUA_TFUNCTION`, `LUA_TUSERDATA`, `LUA_TTHREAD`, and `LUA_TLIGHTUSERDATA`.\n
lua_typename lua_typename(lua_State *L, int tp) [const char*]\nReturns the name of the type encoded by the value `tp`, which must be one\nthe values returned by `lua_type`.\n
+lua_Unsigned lua_Unsigned [typedef unsigned long lua_Unsigned]\nThe type used by the Lua API to represent unsigned integral values. It must\nhave at least 32 bits.\n\nBy default it is an `unsigned int` or an `unsigned long`, whichever can hold\n32-bit values.\n
+lua_version lua_version(lua_State *L) [const lua_Number]\nReturns the address of the version number stored in the Lua core. When called\nwith a valid `lua_State`, returns the address of the version used to create that\nstate. When called with `NULL`, returns the address of the version running the\ncall.\n
lua_Writer (*lua_Writer)(lua_State *L, const void* p, size_t sz, void* ud) [int]\nThe type of the writer function used by `lua_dump`. Every time it produces\nanother piece of chunk, `lua_dump` calls the writer, passing along the buffer\nto be written (`p`), its size (`sz`), and the `data` parameter supplied to\n`lua_dump`.\n\nThe writer returns an error code: 0 means no errors; any other value means\nan error and stops `lua_dump` from calling the writer again.\n
-lua_xmove lua_xmove(lua_State *from, lua_State *to, int n) [void]\nExchange values between different threads of the _same_ global state.\n\nThis function pops `n` values from the stack `from`, and pushes them onto\nthe stack `to`.\n
-lua_yield lua_yield(lua_State *L, int nresults) [int]\nYields a coroutine.\n\nThis function should only be called as the return expression of a C function,\nas follows:\n\n return lua_yield (L, nresults);\n\nWhen a C function calls `lua_yield` in that way, the running coroutine\nsuspends its execution, and the call to `lua_resume` that started this\ncoroutine returns. The parameter `nresults` is the number of values from\nthe stack that are passed as results to `lua_resume`.\n
-lua_Debug lua_Debug [struct]\ntypedef struct lua_Debug {\n int event;\n const char *name; /* (n) */\n const char *namewhat; /* (n) */\n const char *what; /* (S) */\n const char *source; /* (S) */\n int currentline; /* (l) */\n int nups; /* (u) number of upvalues */\n int linedefined; /* (S) */\n int lastlinedefined; /* (S) */\n char short_src[LUA_IDSIZE]; /* (S) */\n /* private part */\n _other fields_\n} lua_Debug;\n\nA structure used to carry different pieces of information about an active\nfunction. `lua_getstack` fills only the private part of this structure, for\nlater use. To fill the other fields of `lua_Debug` with useful information,\ncall `lua_getinfo`.\n\nThe fields of `lua_Debug` have the following meaning:\n * source: If the function was defined in a string, then `source` is that \n string. If the function was defined in a file, then `source` starts with a\n '@' followed by the file name.\n * short_src: a "printable" version of `source`, to be used in error messages.\n * linedefined: the line number where the definition of the function starts.\n * lastlinedefined: the line number where the definition of the function ends.\n * what: the string "Lua" if the function is a Lua function, "C" if it is a\n C function, "main" if it is the main part of a chunk, and "tail" if it was\n a function that did a tail call. In the latter case, Lua has no other\n information about the function.\n * currentline: the current line where the given function is executing.\n When no line information is available, `currentline` is set to -1.\n * name: a reasonable name for the given function. Because functions in Lua \n are first-class values, they do not have a fixed name: some functions\n can be the value of multiple global variables, while others can be\n stored only in a table field. The `lua_getinfo` function checks how the\n function was called to find a suitable name. If it cannot find a name,\n then `name` is set to `NULL`.\n * namewhat: explains the `name` field. The value of `namewhat` can be \n "global", "local", "method", "field", "upvalue", or "" (the empty string),\n according to how the function was called. (Lua uses the empty string\n when no other option seems to apply.)\n * nups: the number of upvalues of the function.\n
+lua_xmove lua_xmove(lua_State *from, lua_State *to, int n) [void]\nExchange values between different threads of the same state.\n\nThis function pops `n` values from the stack `from`, and pushes them onto\nthe stack `to`.\n
+lua_yield lua_yield(lua_State *L, int nresults) [int]\nThis function is equivalent to `lua_yieldk`, but it has no continuation\n(see §4.7). Therefore, when the thread resumes, it returns to the function that\ncalled the function calling `lua_yield`.\n
+lua_yieldk lua_yieldk(lua_State *L, int nresults, int ctx, lua_CFunction k) [int]\nYields a coroutine.\n\nThis function should only be called as the return expression of a C function,\nas follows:\n\n return lua_yieldk (L, n, i, k);\n\nWhen a C function calls `lua_yieldk` in that way, the running coroutine\nsuspends its execution, and the call to `lua_resume` that started this\ncoroutine returns. The parameter `nresults` is the number of values from\nthe stack that are passed as results to `lua_resume`.\n\nWhen the coroutine is resumed again, Lua calls the given continuation function\n`k` to continue the execution of the C function that yielded (see §4.7). This\ncontinuation function receives the same stack from the previous function, with\nthe results removed and replaced by the arguments passed to `lua_resume`.\nMoreover, the continuation function may access the value `ctx` by calling\n`lua_getctx`.\n
+lua_Debug lua_Debug [struct]\ntypedef struct lua_Debug {\n int event;\n const char *name; /* (n) */\n const char *namewhat; /* (n) */\n const char *what; /* (S) */\n const char *source; /* (S) */\n int currentline; /* (l) */\n int linedefined; /* (S) */\n int lastlinedefined; /* (S) */\n unsigned char nups; /* (u) number of upvalues */\n unsigned char nparams; /* (u) number of parameters */\n char isvararg; /* (u) */\n char istailcall; /* (t) */\n char short_src[LUA_IDSIZE]; /* (S) */\n /* private part */\n _other fields_\n} lua_Debug;\n\nA structure used to carry different pieces of information about a function or an\nactivation record. `lua_getstack` fills only the private part of this\nstructure, for later use. To fill the other fields of `lua_Debug` with useful\ninformation, call `lua_getinfo`.\n\nThe fields of `lua_Debug` have the following meaning:\n * source: the source of the chunk that created the function. If `source`\n starts with a '`@`', it means that the function was defined in a file where\n the file name follows the '`@`'. If `source` starts with a '`=`', the\n remainder of its contents describe the source in a user-dependent manner.\n Otherwise, the function was defined in a string where `source` is that\n string.\n * short_src: a "printable" version of `source`, to be used in error messages.\n * linedefined: the line number where the definition of the function starts.\n * lastlinedefined: the line number where the definition of the function ends.\n * what: the string "Lua" if the function is a Lua function, "C" if it is a\n C function, "main" if it is the main part of a chunk.\n * currentline: the current line where the given function is executing.\n When no line information is available, `currentline` is set to -1.\n * name: a reasonable name for the given function. Because functions in Lua\n are first-class values, they do not have a fixed name: some functions\n can be the value of multiple global variables, while others can be\n stored only in a table field. The `lua_getinfo` function checks how the\n function was called to find a suitable name. If it cannot find a name,\n then `name` is set to `NULL`.\n * namewhat: explains the `name` field. The value of `namewhat` can be\n "global", "local", "method", "field", "upvalue", or "" (the empty string),\n according to how the function was called. (Lua uses the empty string\n when no other option seems to apply.)\n * istailcall: true if this function invocation was called by a tail call. In\n this case, the caller of this level is not in the stack.\n * nups: the number of upvalues of the function.\n * nparams: the number of fixed parameters of the function (always 0 for C\n functions).\n * isvararg: true if the function is a vararg function (always true for C\n functions).\n
lua_gethook lua_gethook(lua_State *L) [lua_Hook]\nReturns the current hook function.\n
lua_gethookcount lua_gethookcount(lua_State *L) [int]\nReturns the current hook count.\n
lua_gethookmask lua_gethookmask(lua_State *L) [int]\nReturns the current hook mask.\n
-lua_getinfo lua_getinfo(lua_State *L, const char *what, lua_Debug *ar) [int]\nReturns information about a specific function or function invocation.\n\nTo get information about a function invocation, the parameter `ar` must be a\nvalid activation record that was filled by a previous call to `lua_getstack`\nor given as argument to a hook (see `lua_Hook`).\n\nTo get information about a function you push it onto the stack and start the\n`what` string with the character '>'. (In that case, `lua_getinfo` pops the\nfunction in the top of the stack.) For instance, to know in which line a\nfunction `f` was defined, you can write the following code:\n\n lua_Debug ar;\n lua_getfield(L, LUA_GLOBALSINDEX, "f"); /* get global 'f' */\n lua_getinfo(L, ">S", &ar);\n printf("%d\n", ar.linedefined);\n\nEach character in the string `what` selects some fields of the structure\n`ar` to be filled or a value to be pushed on the stack:\n * 'n': fills in the field `name` and `namewhat`;\n * 'S': fills in the fields `source`, `short_src`, `linedefined`, \n `lastlinedefined`, and `what`;\n * 'l': fills in the field `currentline`;\n * 'u': fills in the field `nups`;\n * 'f': pushes onto the stack the function that is running at the given level;\n * 'L': pushes onto the stack a table whose indices are the numbers of the \n lines that are valid on the function. (A _valid line_ is a line with\n some associated code, that is, a line where you can put a break point.\n Non-valid lines include empty lines and comments.)\n\nThis function returns 0 on error (for instance, an invalid option in `what`).\n
-lua_getlocal lua_getlocal(lua_State *L, lua_Debug *ar, int n) [const char*]\nGets information about a local variable of a given activation record.\nThe parameter `ar` must be a valid activation record that was filled\nby a previous call to `lua_getstack` or given as argument to a hook (see\n`lua_Hook`). The index `n` selects which local variable to inspect (1 is the\nfirst parameter or active local variable, and so on, until the last active\nlocal variable). `lua_getlocal` pushes the variable's value onto the stack\nand returns its name.\n\nVariable names starting with '(' (open parentheses) represent internal\nvariables (loop control variables, temporaries, and C function locals).\n\nReturns `NULL` (and pushes nothing) when the index is greater than the number\nof active local variables.\n
-lua_getstack lua_getstack(lua_State *L, int level, lua_Debug *ar) [int]\nGet information about the interpreter runtime stack.\n\nThis function fills parts of a `lua_Debug` structure with an identification of\nthe _activation record_ of the function executing at a given level. Level 0\nis the current running function, whereas level _n+1_ is the function that\nhas called level _n_. When there are no errors, `lua_getstack` returns 1;\nwhen called with a level greater than the stack depth, it returns 0.\n
+lua_getinfo lua_getinfo(lua_State *L, const char *what, lua_Debug *ar) [int]\nReturns information about a specific function or function invocation.\n\nTo get information about a function invocation, the parameter `ar` must be a\nvalid activation record that was filled by a previous call to `lua_getstack`\nor given as argument to a hook (see `lua_Hook`).\n\nTo get information about a function you push it onto the stack and start the\n`what` string with the character '>'. (In that case, `lua_getinfo` pops the\nfunction from the top of the stack.) For instance, to know in which line a\nfunction `f` was defined, you can write the following code:\n\n lua_Debug ar;\n lua_getglobal(L, "f"); /* get global 'f' */\n lua_getinfo(L, ">S", &ar);\n printf("%d\n", ar.linedefined);\n\nEach character in the string `what` selects some fields of the structure\n`ar` to be filled or a value to be pushed on the stack:\n * 'n': fills in the field `name` and `namewhat`;\n * 'S': fills in the fields `source`, `short_src`, `linedefined`,\n `lastlinedefined`, and `what`;\n * 'l': fills in the field `currentline`;\n * 't': fills in the field `istailcall`;\n * 'u': fills in the fields `nups`, `nparams`, and `isvararg`;\n * 'f': pushes onto the stack the function that is running at the given level;\n * 'L': pushes onto the stack a table whose indices are the numbers of the\n lines that are valid on the function. (A _valid line_ is a line with\n some associated code, that is, a line where you can put a break point.\n Non-valid lines include empty lines and comments.)\n\nThis function returns 0 on error (for instance, an invalid option in `what`).\n
+lua_getlocal lua_getlocal(lua_State *L, lua_Debug *ar, int n) [const char*]\nGets information about a local variable of a given activation record or a given\nfunction.\n\nIn the first case, the parameter `ar` must be a valid activation record that was\nfilled by a previous call to `lua_getstack` or given as argument to a hook (see\n`lua_Hook`). The index `n` selects which local variable to inspect; see\n`debug.getlocal` for details about variable indices and names.\n\n`lua_getlocal` pushes the variable's value onto the stack and returns its name.\n\nIn the second case, `ar` should be `NULL` and the function to be inspected must\nbe at the top of the stack. In this case, only parameters of Lua functions are\nvisible (as there is no information about what variables are active) and no\nvalues are pushed onto the stack.\n\nReturns `NULL` (and pushes nothing) when the index is greater than the number of\nactive local variables.\n
+lua_getstack lua_getstack(lua_State *L, int level, lua_Debug *ar) [int]\nGet information about the interpreter runtime stack.\n\nThis function fills parts of a `lua_Debug` structure with an identification of\nthe _activation record_ of the function executing at a given level. Level 0\nis the current running function, whereas level _n+1_ is the function that\nhas called level _n_ (except for tail calls, which do not count on the stack).\nWhen there are no errors, `lua_getstack` returns 1; when called with a level\ngreater than the stack depth, it returns 0.\n
lua_getupvalue lua_getupvalue(lua_State *L, int funcindex, int n) [const char*]\nGets information about a closure's upvalue. (For Lua functions, upvalues are\nthe external local variables that the function uses, and that are consequently\nincluded in its closure.) `lua_getupvalue` gets the index `n` of an upvalue,\npushes the upvalue's value onto the stack, and returns its name.`funcindex`\npoints to the closure in the stack. (Upvalues have no particular order,\nas they are active through the whole function. So, they are numbered in an\narbitrary order.)\n\nReturns `NULL` (and pushes nothing) when the index is greater than the\nnumber of upvalues. For C functions, this function uses the empty string\n"" as a name for all upvalues.\n
-lua_Hook (*lua_Hook)(lua_State *L, lua_Debug *ar) [void]\nType for debugging hook functions.\n\nWhenever a hook is called, its `ar` argument has its field `event` set to the\nspecific event that triggered the hook. Lua identifies these events with\nthe following constants: `LUA_HOOKCALL`, `LUA_HOOKRET`, `LUA_HOOKTAILRET`,\n`LUA_HOOKLINE`, and `LUA_HOOKCOUNT`. Moreover, for line events, the\nfield `currentline` is also set. To get the value of any other field in\n`ar`, the hook must call `lua_getinfo`. For return events, `event` can be\n`LUA_HOOKRET`, the normal value, or `LUA_HOOKTAILRET`. In the latter case,\nLua is simulating a return from a function that did a tail call; in this case,\nit is useless to call `lua_getinfo`.\n\nWhile Lua is running a hook, it disables other calls to hooks. Therefore,\nif a hook calls back Lua to execute a function or a chunk, this execution\noccurs without any calls to hooks.\n
-lua_sethook lua_sethook(lua_State *L, lua_Hook f, int mask, int count) [int]\nSets the debugging hook function.\n\nArgument `f` is the hook function.\n\n`mask` specifies on which events the hook will be called: it is formed by a\nbitwise or of the constants `LUA_MASKCALL`, `LUA_MASKRET`, `LUA_MASKLINE`,\nand `LUA_MASKCOUNT`. The `count` argument is only meaningful when the mask\nincludes `LUA_MASKCOUNT`. For each event, the hook is called as explained\nbelow:\n * The call hook: is called when the interpreter calls a function. The hook is \n called just after Lua enters the new function, before the function gets\n its arguments.\n * The return hook: is called when the interpreter returns from a function.\n The hook is called just before Lua leaves the function. You have no\n access to the values to be returned by the function.\n * The line hook: is called when the interpreter is about to start the \n execution of a new line of code, or when it jumps back in the code (even\n to the same line). (This event only happens while Lua is executing a\n Lua function.)\n * The count hook: is called after the interpreter executes every `count` \n instructions. (This event only happens while Lua is executing a Lua\n function.)\n\nA hook is disabled by setting `mask` to zero.\n
+lua_Hook (*lua_Hook)(lua_State *L, lua_Debug *ar) [void]\nType for debugging hook functions.\n\nWhenever a hook is called, its `ar` argument has its field `event` set to the\nspecific event that triggered the hook. Lua identifies these events with\nthe following constants: `LUA_HOOKCALL`, `LUA_HOOKRET`, `LUA_HOOKTAILCALL`,\n`LUA_HOOKLINE`, and `LUA_HOOKCOUNT`. Moreover, for line events, the\nfield `currentline` is also set. To get the value of any other field in\n`ar`, the hook must call `lua_getinfo`.\n\nFor call events, `event` can be `LUA_HOOKCALL`, the normal value, or\n`LUA_HOOKTAILCALL`, for a tail call; in this case, there will be no\ncorresponding return event.\n\nWhile Lua is running a hook, it disables other calls to hooks. Therefore,\nif a hook calls back Lua to execute a function or a chunk, this execution\noccurs without any calls to hooks.\n
+lua_sethook lua_sethook(lua_State *L, lua_Hook f, int mask, int count) [int]\nSets the debugging hook function.\n\nArgument `f` is the hook function.\n\n`mask` specifies on which events the hook will be called: it is formed by a\nbitwise or of the constants `LUA_MASKCALL`, `LUA_MASKRET`, `LUA_MASKLINE`,\nand `LUA_MASKCOUNT`. The `count` argument is only meaningful when the mask\nincludes `LUA_MASKCOUNT`. For each event, the hook is called as explained\nbelow:\n * The call hook: is called when the interpreter calls a function. The hook is\n called just after Lua enters the new function, before the function gets\n its arguments.\n * The return hook: is called when the interpreter returns from a function.\n The hook is called just before Lua leaves the function. There is no\n standard way to access the values to be returned by the function.\n * The line hook: is called when the interpreter is about to start the\n execution of a new line of code, or when it jumps back in the code (even\n to the same line). (This event only happens while Lua is executing a\n Lua function.)\n * The count hook: is called after the interpreter executes every `count`\n instructions. (This event only happens while Lua is executing a Lua\n function.)\n\nA hook is disabled by setting `mask` to zero.\n
lua_setlocal lua_setlocal(lua_State *L, lua_Debug *ar, int n) [const char*]\nSets the value of a local variable of a given activation record. Parameters\n`ar` and `n` are as in `lua_getlocal` (see `lua_getlocal`). `lua_setlocal`\nassigns the value at the top of the stack to the variable and returns its name.\nIt also pops the value from the stack.\n\nReturns `NULL` (and pops nothing) when the index is greater than the number\nof active local variables.\n
lua_setupvalue lua_setupvalue(lua_State *L, int funcindex, int n) [const char*]\nSets the value of a closure's upvalue. It assigns the value at the top of\nthe stack to the upvalue and returns its name. It also pops the value from\nthe stack. Parameters `funcindex` and `n` are as in the `lua_getupvalue`\n(see `lua_getupvalue`).\n\nReturns `NULL` (and pops nothing) when the index is greater than the number\nof upvalues.\n
-luaL_addchar luaL_addchar(luaL_Buffer *B, char c) [void]\nAdds the character `c` to the buffer `B` (see `luaL_Buffer`).\n
-luaL_addlstring luaL_addlstring(luaL_Buffer *B, const char *s, size_t l) [void]\nAdds the string pointed to by `s` with length `l` to the buffer `B` (see\n`luaL_Buffer`). The string may contain embedded zeros.\n
+lua_upvalueid lua_upvalueid(lua_State *L, int funcindex, int n) [void*]\nReturns an unique identifier for the upvalue numbered `n` from the closure at\nindex `fidx`. Parameters `funcindex` and `n` are as in the `lua_getupvalue`\n(see `lua_getupvalue`) (but `n` cannot be greater than the number of upvalues).\n\nThese unique identifiers allow a program to check whether different closures\nshare upvalues. Lua closures that share an upvalue (that is, that access a same\nexternal local variable) will return identical ids for those upvalue indices.\n
+lua_upvaluejoin lua_upvaluejoin(lua_State *L, int fidx1, int n1, int fidx2, int n2) [void]\nMake the `n1`-th upvalue of the Lua closure at index `fidx1` refer to the\n`n2`-th upvalue of the Lua closure at index `fidx2`.\n
+luaL_addchar luaL_addchar(luaL_Buffer *B, char c) [void]\nAdds the byte `c` to the buffer `B` (see `luaL_Buffer`).\n
+luaL_addlstring luaL_addlstring(luaL_Buffer *B, const char *s, size_t l) [void]\nAdds the string pointed to by `s` with length `l` to the buffer `B` (see\n`luaL_Buffer`). The string can contain embedded zeros.\n
luaL_addsize luaL_addsize(luaL_Buffer *B, size_t n) [void]\nAdds to the buffer `B` (see `luaL_Buffer`) a string of length `n` previously\ncopied to the buffer area (see `luaL_prepbuffer`).\n
-luaL_addstring luaL_addstring(luaL_Buffer *B, const char *s) [void]\nAdds the zero-terminated string pointed to by `s` to the buffer `B` (see\n`luaL_Buffer`). The string may not contain embedded zeros.\n
+luaL_addstring luaL_addstring(luaL_Buffer *B, const char *s) [void]\nAdds the zero-terminated string pointed to by `s` to the buffer `B` (see\n`luaL_Buffer`). The string cannot contain embedded zeros.\n
luaL_addvalue luaL_addvalue(luaL_Buffer *B) [void]\nAdds the value at the top of the stack to the buffer `B` (see `luaL_Buffer`).\nPops the value.\n\nThis is the only function on string buffers that can (and must) be called with\nan extra element on the stack, which is the value to be added to the buffer.\n
-luaL_argcheck luaL_argcheck(lua_State *L, int cond, int narg, const char *extramsg) [void]\nChecks whether `cond` is true. If not, raises an error with the following\nmessage, where `func` is retrieved from the call stack:\n\n bad argument #<narg> to <func> (<extramsg>)\n
-luaL_argerror luaL_argerror(lua_State *L, int narg, const char *extramsg) [int]\nRaises an error with the following message, where `func` is retrieved from\nthe call stack:\n\n bad argument #<narg> to <func> (<extramsg>)\n\nThis function never returns, but it is an idiom to use it in C functions as\n`return luaL_argerror(args)`.\n
-luaL_Buffer luaL_Buffer [struct]\nType for a _string buffer_.\n\nA string buffer allows C code to build Lua strings piecemeal. Its pattern\nof use is as follows:\n * First you declare a variable `b` of type `luaL_Buffer`.\n * Then you initialize it with a call `luaL_buffinit(L, &b)`.\n * Then you add string pieces to the buffer calling any of the `luaL_add*` \n functions.\n * You finish by calling `luaL_pushresult(&b)`. This call leaves the final \n string on the top of the stack.\nDuring its normal operation, a string buffer uses a variable number of\nstack slots. So, while using a buffer, you cannot assume that you know\nwhere the top of the stack is. You can use the stack between successive\ncalls to buffer operations as long as that use is balanced; that is, when you\ncall a buffer operation, the stack is at the same level it was immediately\nafter the previous buffer operation. (The only exception to this rule is\n`luaL_addvalue`.) After calling `luaL_pushresult` the stack is back to its\nlevel when the buffer was initialized, plus the final string on its top.\n
+luaL_argcheck luaL_argcheck(lua_State *L, int cond, int narg, const char *extramsg) [void]\nChecks whether `cond` is true. If not, raises an error with a standard message.\n
+luaL_argerror luaL_argerror(lua_State *L, int narg, const char *extramsg) [int]\nRaises an error with a standard message that includes `extramsg` as a comment.\n\nThis function never returns, but it is an idiom to use it in C functions as\n`return luaL_argerror(args)`.\n
+luaL_Buffer luaL_Buffer [struct]\nType for a _string buffer_.\n\nA string buffer allows C code to build Lua strings piecemeal. Its pattern\nof use is as follows:\n * First declare a variable `b` of type `luaL_Buffer`.\n * Then initialize it with a call `luaL_buffinit(L, &b)`.\n * Then add string pieces to the buffer calling any of the `luaL_add*`\n functions.\n * Finish by calling `luaL_pushresult(&b)`. This call leaves the final string\n on the top of the stack.\n\nIf you know beforehand the total size of the resulting string, you can use the\nbuffer like this:\n * First declare a variable `b` of type `luaL_Buffer`.\n * Then initialize it and preallocate a space of size `sz` with a call\n `luaL_buffinitsize(L, &b, sz)`.\n * Then copy the string into that space.\n * Finish by calling `luaL_pushresult(&b, sz)`, where `sz` is the total size of\n the resulting string copied into that space.\n\nDuring its normal operation, a string buffer uses a variable number of\nstack slots. So, while using a buffer, you cannot assume that you know\nwhere the top of the stack is. You can use the stack between successive\ncalls to buffer operations as long as that use is balanced; that is, when you\ncall a buffer operation, the stack is at the same level it was immediately\nafter the previous buffer operation. (The only exception to this rule is\n`luaL_addvalue`.) After calling `luaL_pushresult` the stack is back to its\nlevel when the buffer was initialized, plus the final string on its top.\n
luaL_buffinit luaL_buffinit(lua_State *L, luaL_Buffer *B) [void]\nInitializes a buffer `B`. This function does not allocate any space; the\nbuffer must be declared as a variable (see `luaL_Buffer`).\n
-luaL_callmeta luaL_callmeta(lua_State *L, int obj, const char *e) [int]\nCalls a metamethod.\n\nIf the object at index `obj` has a metatable and this metatable has a field\n`e`, this function calls this field and passes the object as its only\nargument. In this case this function returns 1 and pushes onto the stack\nthe value returned by the call. If there is no metatable or no metamethod,\nthis function returns 0 (without pushing any value on the stack).\n
+luaL_buffinitsize luaL_buffinitsize(lua_State *L, luaL_Buffer *B, size_t sz) [char*]\nEquivalent to the sequence `luaL_buffinit`, `luaL_prepbuffsize`.\n
+luaL_callmeta luaL_callmeta(lua_State *L, int obj, const char *e) [int]\nCalls a metamethod.\n\nIf the object at index `obj` has a metatable and this metatable has a field\n`e`, this function calls this field passing the object as its only argument.\nIn this case this function returns true and pushes onto the stack the value\nreturned by the call. If there is no metatable or no metamethod, this function\nreturns false (without pushing any value on the stack).\n
luaL_checkany luaL_checkany(lua_State *L, int narg) [void]\nChecks whether the function has an argument of any type (including nil)\nat position `narg`.\n
luaL_checkint luaL_checkint(lua_State *L, int narg) [int]\nChecks whether the function argument `narg` is a number and returns this\nnumber cast to an `int`.\n
luaL_checkinteger luaL_checkinteger(lua_State *L, int narg) [lua_Integer]\nChecks whether the function argument `narg` is a number and returns this\nnumber cast to a `lua_Integer`.\n
luaL_checklong luaL_checklong(lua_State *L, int narg) [long]\nChecks whether the function argument `narg` is a number and returns this\nnumber cast to a `long`.\n
luaL_checklstring luaL_checklstring(lua_State *L, int narg, size_t *l) [const char*]\nChecks whether the function argument `narg` is a string and returns this\nstring; if `l` is not `NULL` fills `*l` with the string's length.\n\nThis function uses `lua_tolstring` to get its result, so all conversions\nand caveats of that function apply here.\n
luaL_checknumber luaL_checknumber(lua_State *L, int narg) [lua_Number]\nChecks whether the function argument `narg` is a number and returns this\nnumber.\n
-luaL_checkoption luaL_checkoption(lua_State *L, int narg, const char *def, const char *const lst[]) [int]\nChecks whether the function argument `narg` is a string and searches for this\nstring in the array `lst` (which must be NULL-terminated). Returns the index\nin the array where the string was found. Raises an error if the argument\nis not a string or if the string cannot be found.\n\nIf `def` is not `NULL`, the function uses `def` as a default value when\nthere is no argument `narg` or if this argument is nil.\n\nThis is a useful function for mapping strings to C enums. (The usual\nconvention in Lua libraries is to use strings instead of numbers to select\noptions.)\n
-luaL_checkstack luaL_checkstack(lua_State *L, int sz, const char *msg) [void]\nGrows the stack size to `top + sz` elements, raising an error if the stack\ncannot grow to that size. `msg` is an additional text to go into the error\nmessage.\n
+luaL_checkoption luaL_checkoption(lua_State *L, int narg, const char *def, const char *const lst[]) [int]\nChecks whether the function argument `narg` is a string and searches for this\nstring in the array `lst` (which must be NULL-terminated). Returns the index\nin the array where the string was found. Raises an error if the argument\nis not a string or if the string cannot be found.\n\nIf `def` is not `NULL`, the function uses `def` as a default value when\nthere is no argument `narg` or when this argument is nil.\n\nThis is a useful function for mapping strings to C enums. (The usual\nconvention in Lua libraries is to use strings instead of numbers to select\noptions.)\n
+luaL_checkstack luaL_checkstack(lua_State *L, int sz, const char *msg) [void]\nGrows the stack size to `top + sz` elements, raising an error if the stack\ncannot grow to that size. `msg` is an additional text to go into the error\nmessage (or `NULL` for no additional text).\n
luaL_checkstring luaL_checkstring(lua_State *L, int narg) [const char*]\nChecks whether the function argument `narg` is a string and returns this\nstring.\n\nThis function uses `lua_tolstring` to get its result, so all conversions\nand caveats of that function apply here.\n
luaL_checktype luaL_checktype(lua_State *L, int narg, int t) [void]\nChecks whether the function argument `narg` has type `t`. See `lua_type`\nfor the encoding of types for `t`.\n
-luaL_checkudata luaL_checkudata(lua_State *L, int narg, const char *tname) [void*]\nChecks whether the function argument `narg` is a userdata of the type `tname`\n(see `luaL_newmetatable`).\n
-luaL_dofile luaL_dofile(lua_State *L, const char *filename) [int]\nLoads and runs the given file. It is defined as the following macro:\n\n (luaL_loadfile(L, filename) || lua_pcall(L, 0, LUA_MULTRET, 0))\n\nIt returns 0 if there are no errors or 1 in case of errors.\n
-luaL_dostring luaL_dostring(lua_State *L, const char *str) [int]\nLoads and runs the given string. It is defined as the following macro:\n\n (luaL_loadstring(L, str) || lua_pcall(L, 0, LUA_MULTRET, 0))\n\nIt returns 0 if there are no errors or 1 in case of errors.\n
+luaL_checkudata luaL_checkudata(lua_State *L, int narg, const char *tname) [void*]\nChecks whether the function argument `narg` is a userdata of the type `tname`\n(see `luaL_newmetatable`) and returns the userdata address (see\n`lua_touserdata`).\n
+luaL_checkunsigned luaL_checkunsigned(lua_State *L, int narg) [lua_Unsigned]\nChecks whether the function argument `narg` is a number and returns this number\ncast to a `lua_Unsigned`.\n
+luaL_checkversion luaL_checkversion(lua_State *L) [void]\nChecks whether the core running the call, the core that created the Lua state,\nand the code making the call are all using the same version of Lua. Also checks\nwhether the core running the call and the core that created the Lua state are\nusing the same address space.\n
+luaL_dofile luaL_dofile(lua_State *L, const char *filename) [int]\nLoads and runs the given file. It is defined as the following macro:\n\n (luaL_loadfile(L, filename) || lua_pcall(L, 0, LUA_MULTRET, 0))\n\nIt returns false if there are no errors or true in case of errors.\n
+luaL_dostring luaL_dostring(lua_State *L, const char *str) [int]\nLoads and runs the given string. It is defined as the following macro:\n\n (luaL_loadstring(L, str) || lua_pcall(L, 0, LUA_MULTRET, 0))\n\nIt returns false if there are no errors or true in case of errors.\n
luaL_error luaL_error(lua_State *L, const char *fmt, ...) [int]\nRaises an error. The error message format is given by `fmt` plus any extra\narguments, following the same rules of `lua_pushfstring`. It also adds at\nthe beginning of the message the file name and the line number where the\nerror occurred, if this information is available.\n\nThis function never returns, but it is an idiom to use it in C functions as\n`return luaL_error(args)`.\n
-luaL_getmetafield luaL_getmetafield(lua_State *L, int obj, const char *e) [int]\nPushes onto the stack the field `e` from the metatable of the object at index\n`obj`. If the object does not have a metatable, or if the metatable does\nnot have this field, returns 0 and pushes nothing.\n
+luaL_execresult luaL_execresult(lua_State *L, int stat) [int]\nThis function produces the return values for process-related functions in the\nstandard library (`os.execute` and `io.close`).\n
+luaL_fileresult luaL_fileresult(lua_State *L, int stat, const char *fname) [int]\nThis function produces the return values for file-related functions in the\nstandard library (`io.open`, `os.rename`, `file:seek`, etc.).\n
+luaL_getmetafield luaL_getmetafield(lua_State *L, int obj, const char *e) [int]\nPushes onto the stack the field `e` from the metatable of the object at index\n`obj`. If the object does not have a metatable, or if the metatable does\nnot have this field, returns false and pushes nothing.\n
luaL_getmetatable luaL_getmetatable(lua_State *L, const char *tname) [void]\nPushes onto the stack the metatable associated with name `tname` in the\nregistry (see `luaL_newmetatable`).\n
+luaL_getsubtable luaL_getsubtable(lua_State *L, int idx, const char *fname) [int]\nEnsures that the value `t[fname]`, where `t` is the value at the valid index\n`idx`, is a table, and pushes that table onto the stack. Returns true if it\nfinds a previous table there and false if it creates a new table.\n
luaL_gsub luaL_gsub(lua_State *L, const char *s, const char *p, const char *r) [const char*]\nCreates a copy of string `s` by replacing any occurrence of the string `p`\nwith the string `r`. Pushes the resulting string on the stack and returns it.\n
-luaL_loadbuffer luaL_loadbuffer(lua_State *L, const char *buff, size_t sz, const char *name) [int] \nLoads a buffer as a Lua chunk. This function uses `lua_load` to load the\nchunk in the buffer pointed to by `buff` with size `sz`.\n\nThis function returns the same results as `lua_load`. `name` is the chunk\nname, used for debug information and error messages.\n
-luaL_loadfile luaL_loadfile(lua_State *L, const char *filename) [int]\nLoads a file as a Lua chunk. This function uses `lua_load` to load the chunk\nin the file named `filename`. If `filename` is `NULL`, then it loads from the\nstandard input. The first line in the file is ignored if it starts with a `#`.\n\nThis function returns the same results as `lua_load`, but it has an extra\nerror code `LUA_ERRFILE` if it cannot open/read the file.\n\nAs `lua_load`, this function only loads the chunk; it does not run it.\n
+luaL_len luaL_len(lua_State *L, int index) [int]\nReturns the "length" of the value at the given acceptable index as a number; it\nis equivalent to the '`#`' operator in Lua (see §3.4.6). Raises an error if the\nresult of the operation is not a number. (This only can happen through\nmetamethods.)\n
+luaL_loadbuffer luaL_loadbuffer(lua_State *L, const char *buff, size_t sz, const char *name) [int]\nEquivalent to `luaL_loadbufferx` with `mode` equal to `NULL`.\n
+luaL_loadbufferx luaL_loadbufferx(lua_State *L, const char *buff, size_t sz, const char *name, const char *mode) [int]\nLoads a buffer as a Lua chunk. This function uses `lua_load` to load the\nchunk in the buffer pointed to by `buff` with size `sz`.\n\nThis function returns the same results as `lua_load`. `name` is the chunk\nname, used for debug information and error messages. The string `mode` works as\nin function `lua_load`.\n
+luaL_loadfile luaL_loadfile(lua_State *L, const char *filename) [int]\nEquivalent to `luaL_loadfilex` with `mode` equal to `NULL`.\n
+luaL_loadfilex luaL_loadfilex(lua_State *L, const char *filename, const char *mode) [int]\nLoads a file as a Lua chunk. This function uses `lua_load` to load the chunk\nin the file named `filename`. If `filename` is `NULL`, then it loads from the\nstandard input. The first line in the file is ignored if it starts with a `#`.\n\nThe string `mode` works as in function `lua_load`.\n\nThis function returns the same results as `lua_load`, but it has an extra\nerror code `LUA_ERRFILE` if it cannot open/read the file or the file has a wrong\nmode.\n\nAs `lua_load`, this function only loads the chunk; it does not run it.\n
luaL_loadstring luaL_loadstring(lua_State *L, const char *s) [int]\nLoads a string as a Lua chunk. This function uses `lua_load` to load the\nchunk in the zero-terminated string `s`.\n\nThis function returns the same results as `lua_load`.\n\nAlso as `lua_load`, this function only loads the chunk; it does not run it.\n
+luaL_newlib luaL_newlib(lua_State *L, const luaL_Reg *l) [int]\nCreates a new table and registers there the functions in list `l`. It is\nimplemented as the following macro:\n\n (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))\n
+luaL_newlibtable luaL_newlibtable(lua_State *L, const luaL_Reg l[]) [int]\nCreates a new table with a size optimized to store all entries in the array `l`\n(but does not actually store them). It is intended to be used in conjunction\nwith `luaL_setfuncs` (see `luaL_newlib`).\n\nIt is implemented as a macro. The array `l` must be the actual array, not a\npointer to it.\n
luaL_newmetatable luaL_newmetatable(lua_State *L, const char *tname) [int]\nIf the registry already has the key `tname`, returns 0. Otherwise, creates\na new table to be used as a metatable for userdata, adds it to the registry\nwith key `tname`, and returns 1.\n\nIn both cases pushes onto the stack the final value associated with `tname`\nin the registry.\n
luaL_newstate luaL_newstate(void) [lua_State*]\nCreates a new Lua state. It calls `lua_newstate` with an allocator based\non the standard C `realloc` function and then sets a panic function (see\n`lua_atpanic`) that prints an error message to the standard error output in\ncase of fatal errors.\n\nReturns the new state, or `NULL` if there is a memory allocation error.\n
luaL_openlibs luaL_openlibs(lua_State *L) [void]\nOpens all standard Lua libraries into the given state.\n
luaL_optint luaL_optint(lua_State *L, int narg, int d) [int]\nIf the function argument `narg` is a number, returns this number cast to\nan `int`. If this argument is absent or is nil, returns `d`. Otherwise,\nraises an error.\n
luaL_optinteger luaL_optinteger(lua_State *L, int narg, lua_Integer d) [lua_Integer]\nIf the function argument `narg` is a number, returns this number cast to a\n`lua_Integer`. If this argument is absent or is nil, returns `d`. Otherwise,\nraises an error.\n
luaL_optlong luaL_optlong(lua_State *L, int narg, long d) [long]\nIf the function argument `narg` is a number, returns this number cast to a\n`long`. If this argument is absent or is nil, returns `d`. Otherwise,\nraises an error.\n
-luaL_optlstring luaL_optlstring(lua_State *L, int narg, const char *d, size_t *l) [const char*]\nIf the function argument `narg` is a string, returns this string. If this\nargument is absent or is nil, returns `d`. Otherwise, raises an error.\n\nIf `l` is not `NULL`, fills the position `*l` with the results's length.\n
+luaL_optlstring luaL_optlstring(lua_State *L, int narg, const char *d, size_t *l) [const char*]\nIf the function argument `narg` is a string, returns this string. If this\nargument is absent or is nil, returns `d`. Otherwise, raises an error.\n\nIf `l` is not `NULL`, fills the position `*l` with the result's length.\n
luaL_optnumber luaL_optnumber(lua_State *L, int narg, lua_Number d) [lua_Number]\nIf the function argument `narg` is a number, returns this number. If this\nargument is absent or is nil, returns `d`. Otherwise, raises an error.\n
luaL_optstring luaL_optstring(lua_State *L, int narg, const char *d) [const char*]\nIf the function argument `narg` is a string, returns this string. If this\nargument is absent or is nil, returns `d`. Otherwise, raises an error.\n
-luaL_prepbuffer luaL_prepbuffer(luaL_Buffer *B) [char*]\nReturns an address to a space of size `LUAL_BUFFERSIZE` where you can copy\na string to be added to buffer `B` (see `luaL_Buffer`). After copying the\nstring into this space you must call `luaL_addsize` with the size of the\nstring to actually add it to the buffer.\n
+luaL_optunsigned luaL_optunsigned(lua_State *L, int narg, lua_Unsigned u) [lua_Unsigned]\nIf the function argument `narg` is a number, returns this number cast to a\n`lua_Unsigned`. If this argument is absent or is nil, returns `u`. Otherwise,\nraises an error.\n
+luaL_prepbuffer luaL_prepbuffer(luaL_Buffer *B) [char*]\nEquivalent to `luaL_prepbuffsize` with the predefined size `LUAL_BUFFERSIZE`.\n
+luaL_prepbuffsize luaL_prepbuffsize(luaL_Buffer *B, size_t sz) [char*]\nReturns an address to a space of size `LUAL_BUFFERSIZE` where you can copy\na string to be added to buffer `B` (see `luaL_Buffer`). After copying the\nstring into this space you must call `luaL_addsize` with the size of the\nstring to actually add it to the buffer.\n
luaL_pushresult luaL_pushresult(luaL_Buffer *B) [void]\nFinishes the use of buffer `B` leaving the final string on the top of\nthe stack.\n
+luaL_pushresultsize luaL_pushresultsize(luaL_Buffer *B, size_t sz) [void]\nEquivalent to the sequence `luaL_addsize`, `luaL_pushresult`.\n
luaL_ref luaL_ref(lua_State *L, int t) [int]\nCreates and returns a _reference_, in the table at index `t`, for the object\nat the top of the stack (and pops the object).\n\nA reference is a unique integer key. As long as you do not manually add\ninteger keys into table `t`, `luaL_ref` ensures the uniqueness of the key\nit returns. You can retrieve an object referred by reference `r` by calling\n`lua_rawgeti(L, t, r)`. Function `luaL_unref` frees a reference and its\nassociated object.\n\nIf the object at the top of the stack is nil, `luaL_ref` returns the constant\n`LUA_REFNIL`. The constant `LUA_NOREF` is guaranteed to be different from\nany reference returned by `luaL_ref`.\n
-luaL_Reg luaL_Reg [struct]\ntypedef struct luaL_Reg {\n const char *name;\n lua_CFunction func;\n} luaL_Reg;\n\nType for arrays of functions to be registered by `luaL_register`. `name`\nis the function name and `func` is a pointer to the function. Any array of\n`luaL_Reg` must end with an sentinel entry in which both `name` and `func`\nare `NULL`.\n
-luaL_register luaL_register(lua_State *L, const char *libname, const luaL_Reg *l) [void]\nOpens a library.\n\nWhen called with `libname` equal to `NULL`, it simply registers all functions\nin the list `l` (see `luaL_Reg`) into the table on the top of the stack.\n\nWhen called with a non-null `libname`, `luaL_register` creates a new table\n`t`, sets it as the value of the global variable `libname`, sets it as the\nvalue of `package.loaded[libname]`, and registers on it all functions in the\nlist `l`. If there is a table in `package.loaded[libname]` or in variable\n`libname`, reuses this table instead of creating a new one.\n\nIn any case the function leaves the table on the top of the stack.\n
+luaL_Reg luaL_Reg [struct]\ntypedef struct luaL_Reg {\n const char *name;\n lua_CFunction func;\n} luaL_Reg;\n\nType for arrays of functions to be registered by `luaL_setfuncs\nis the function name and `func` is a pointer to the function. Any array of\n`luaL_Reg` must end with an sentinel entry in which both `name` and `func`\nare `NULL`.\n
+luaL_requiref luaL_requiref(lua_State *L, const char *modname, lua_CFunction openf, int glb) [void]\nCalls function `openf` with string `modname` as an argument and sets the call\nresult in `package.loaded[modname]`, as if that function has been called through\n`require`.\n\nIf `glb` is true, also stores the result into global `modname`.\n\nLeaves a copy of that result on the stack.\n
+luaL_setfuncs luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup) [void]\nRegisters all functions in the array `l` (see `luaL_Reg`) into the table on the\ntop of the stack (below optional upvalues, see next).\n\nWhen `nup` is not zero, all functions are created sharing `nup` upvalues, which\nmust be previously pushed on the stack on top of the library table. These\nvalues are popped from the stack after the registration.\n
+luaL_setmetatable luaL_setmetatable(lua_State *L, const char *tname) [void]\nSets the metatable of the object at the top of the stack as the metatable\nassociated with name `tname` in the registry (see `luaL_newmetatable`).\n
+luaL_testudata luaL_testudata(lua_State *L, int narg, const char *tname) [void]\nThis function works like `luaL_checkudata`, except that, when the test fails,\nit returns `NULL` instead of throwing an error.\n
+luaL_tolstring luaL_tolstring(lua_State *L, int idx, size_t *len) [const char*]\nConverts any Lua value at the given acceptable index to a C string in a\nreasonable format. The resulting string is pushed onto the stack and also\nreturned by the function. If `len` is not `NULL`, the function also sets `*len`\nwith the string length.\n\nIf the value has a metatable with a `"__tostring"` field, then `luaL_tolstring`\ncalls the corresponding metamethod with the value as argument, and uses the\nresult of the call as its result.\n
+luaL_traceback luaL_traceback(lua_State *L, lua_State *L1, const char *msg, int level) [void]\nCreates and pushes a traceback of the stack `L1`. If `msg` is not `NULL` it is\nappended at the beginning of the traceback. The `level` parameter tells at\nwhich level to start the traceback.\n
luaL_typename luaL_typename(lua_State *L, int index) [const char*]\nReturns the name of the type of the value at the given index.\n
-luaL_typerror luaL_typerror(lua_State *L, int narg, const char *tname) [int]\nGenerates an error with a message like the following:\n\n [location]: bad argument [narg] to '[func]' ([tname] expected, got [rt])\n\nwhere [location] is produced by `luaL_where`, [func] is the name of the\ncurrent function, and [rt] is the type name of the actual argument.\n
luaL_unref luaL_unref(lua_State *L, int t, int ref) [void]\nReleases reference `ref` from the table at index `t` (see `luaL_ref`).\nThe entry is removed from the table, so that the referred object can be\ncollected. The reference `ref` is also freed to be used again.\n\nIf `ref` is `LUA_NOREF` or `LUA_REFNIL`, `luaL_unref` does nothing.\n
luaL_where luaL_where(lua_State *L, int lvl) [void]\nPushes onto the stack a string identifying the current position of the\ncontrol at level `lvl` in the call stack. Typically this string has the\nfollowing format:\n\n _chunkname_:_currentline_:\n\nLevel 0 is the running function, level 1 is the function that called the\nrunning function, etc.\n\nThis function is used to build a prefix for error messages.\n
diff --git a/modules/lua/init.lua b/modules/lua/init.lua
index ea4b7874..80bf7956 100644
--- a/modules/lua/init.lua
+++ b/modules/lua/init.lua
@@ -1,11 +1,14 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local M = {}
+
+--[[
---
-- The lua module.
-- It provides utilities for editing Lua code.
-- User tags are loaded from _USERHOME/modules/lua/tags and user apis are loaded
-- from _USERHOME/modules/lua/api.
-module('_m.lua', package.seeall)
+module('_m.lua', package.seeall)]]
-- Markdown:
-- ## Key Commands
@@ -35,38 +38,39 @@ m_run.error_detail.lua = {
---
-- Sets default buffer properties for Lua files.
-function set_buffer_properties()
+-- @name set_buffer_properties
+function M.set_buffer_properties()
end
-- Adeptsense.
-sense = _m.textadept.adeptsense.new('lua')
-sense.syntax.class_definition = 'module%s*%(?%s*[\'"]([%w_%.]+)'
-sense.syntax.symbol_chars = '[%w_%.:]'
-sense.syntax.type_declarations = {}
-sense.syntax.type_assignments = {
+M.sense = _m.textadept.adeptsense.new('lua')
+M.sense.syntax.class_definition = 'module%s*%(?%s*[\'"]([%w_%.]+)'
+M.sense.syntax.symbol_chars = '[%w_%.:]'
+M.sense.syntax.type_declarations = {}
+M.sense.syntax.type_assignments = {
['^[\'"]'] = 'string', -- foo = 'bar' or foo = "bar"
['^([%w_%.]+)%s*$'] = '%1', -- foo = _m.textadept.adeptsense
['^(_m%.textadept%.adeptsense)%.new'] = '%1',
['require%s*%(?%s*(["\'])([%w_%.]+)%1%)?'] = '%2',
['^io%.p?open%s*%b()%s*$'] = 'file'
}
-sense.api_files = { _HOME..'/modules/lua/api' }
-sense:add_trigger('.')
-sense:add_trigger(':', false, true)
+M.sense.api_files = { _HOME..'/modules/lua/api' }
+M.sense:add_trigger('.')
+M.sense:add_trigger(':', false, true)
-- script/update_doc generates a fake set of ctags used for autocompletion.
-sense.ctags_kinds = {
+M.sense.ctags_kinds = {
f = 'functions',
F = 'fields',
m = 'classes',
t = 'fields',
}
-sense:load_ctags(_HOME..'/modules/lua/tags', true)
+M.sense:load_ctags(_HOME..'/modules/lua/tags', true)
-- Strips '_G' from symbols since it's implied.
-function sense:get_symbol()
+function M.sense:get_symbol()
local symbol, part = self.super.get_symbol(self)
if symbol:find('^_G') then symbol = symbol:gsub('_G%.?', '') end
if part == '_G' then part = '' end
@@ -76,7 +80,7 @@ end
-- Shows an autocompletion list for the symbol behind the caret.
-- If the symbol contains a ':', only display functions. Otherwise, display
-- both functions and fields.
-function sense:complete(only_fields, only_functions)
+function M.sense:complete(only_fields, only_functions)
local line, pos = buffer:get_cur_line()
local symbol = line:sub(1, pos):match(self.syntax.symbol_chars..'*$')
return self.super.complete(self, false, symbol:find(':'))
@@ -84,10 +88,10 @@ end
-- Load user tags and apidoc.
if lfs.attributes(_USERHOME..'/modules/lua/tags') then
- sense:load_ctags(_USERHOME..'/modules/lua/tags')
+ M.sense:load_ctags(_USERHOME..'/modules/lua/tags')
end
if lfs.attributes(_USERHOME..'/modules/lua/api') then
- sense.api_files[#sense.api_files + 1] = _USERHOME..'/modules/lua/api'
+ M.sense.api_files[#M.sense.api_files + 1] = _USERHOME..'/modules/lua/api'
end
-- Commands.
@@ -106,7 +110,8 @@ local control_structure_patterns = {
-- Tries to autocomplete Lua's 'end' keyword for control structures like 'if',
-- 'while', 'for', etc.
-- @see control_structure_patterns
-function try_to_autocomplete_end()
+-- @name try_to_autocomplete_end
+function M.try_to_autocomplete_end()
local buffer = buffer
local line_num = buffer:line_from_position(buffer.current_pos)
local line = buffer:get_line(line_num)
@@ -131,7 +136,8 @@ end
---
-- Determines the Lua file being 'require'd, searches through package.path for
-- that file, and opens it in Textadept.
-function goto_required()
+-- @name goto_required
+function M.goto_required()
local line = buffer:get_cur_line()
local patterns = { 'require%s*(%b())', 'require%s*(([\'"])[^%2]+%2)' }
local file
@@ -140,14 +146,9 @@ function goto_required()
if file then break end
end
if not file then return end
- file = file:sub(2, -2):gsub('%.', '/')
- for path in package.path:gmatch('[^;]+') do
- path = path:gsub('?', file)
- if lfs.attributes(path) then
- io.open_file(path:iconv('UTF-8', _CHARSET))
- break
- end
- end
+ file = package.searchpath(file:sub(2, -2):iconv('UTF-8', _CHARSET),
+ package.path)
+ if file then io.open_file(file) end
end
-- Show syntax errors as annotations.
@@ -175,9 +176,9 @@ keys.lua = {
[keys.LANGUAGE_MODULE_PREFIX] = {
m = { io.open_file,
(_HOME..'/modules/lua/init.lua'):iconv('UTF-8', _CHARSET) },
- g = goto_required,
+ g = M.goto_required,
},
- ['s\n'] = try_to_autocomplete_end,
+ ['s\n'] = M.try_to_autocomplete_end,
}
-- Snippets.
@@ -196,3 +197,5 @@ if type(snippets) == 'table' then
forp = "for %1(k), %2(v) in pairs(%3(table)) do\n\t%0\nend",
}
end
+
+return M
diff --git a/modules/lua/lua.luadoc b/modules/lua/lua.luadoc
index bee093be..3ff20d0b 100644
--- a/modules/lua/lua.luadoc
+++ b/modules/lua/lua.luadoc
@@ -7,19 +7,36 @@ function assert(v [, message]) end
---
-- This function is a generic interface to the garbage collector. It
-- performs different functions according to its first argument, `opt`:
--- "stop": stops the garbage collector.
--- "restart": restarts the garbage collector.
--- "collect": performs a full garbage-collection cycle.
--- "count": returns the total memory in use by Lua (in Kbytes).
+-- "collect": performs a full garbage-collection cycle. This is the default
+-- option.
+-- "stop": stops automatic execution of the garbage collector.
+-- "restart": restarts automatic execution of the garbage collector.
+-- "count": returns the total memory in use by Lua (in Kbytes) and a second
+-- value with the total memory in bytes modulo 1024. The first value
+-- has a fractional part, so the following equality is always true:
+--
+-- k, b = collectgarbage("count")
+-- assert(k*1024 == math.floor(k)*1024 + b)
+--
+-- (The second result is useful when Lua is compiled with a non
+-- floating-point type for numbers.)
-- "step": performs a garbage-collection step. The step "size" is controlled
--- by `arg` (larger values mean more steps) in a non-specified way. If you
--- want to control the step size you must experimentally tune the value of
--- `arg`. Returns true if the step finished a collection cycle.
+-- by `arg` (larger values mean more steps) in a non-specified way. If
+-- you want to control the step size you must experimentally tune the
+-- value of `arg`. Returns true if the step finished a collection
+-- cycle.
-- "setpause": sets `arg` as the new value for the *pause* of the collector
--- (see §2.10). Returns the previous value for *pause*.
+-- (see §2.5). Returns the previous value for *pause*.
-- "setstepmul": sets `arg` as the new value for the *step multiplier*
--- of the collector (see §2.10). Returns the previous value for *step*.
-function collectgarbage(opt [, arg]) end
+-- of the collector (see §2.5). Returns the previous value for
+-- *step*.
+-- "isrunning": returns a boolean that tells whether the collector is running
+-- (i.e., not stopped).
+-- "generational": changes the collector to generational mode. This is an
+-- experimental feature (see §2.5).
+-- "incremental": changes the collector to incremental mode. This is the
+-- default mode.
+function collectgarbage([opt [, arg]]) end
---
-- Opens the named file and executes its contents as a Lua chunk. When
@@ -27,31 +44,24 @@ function collectgarbage(opt [, arg]) end
-- `dofile` executes the contents of the standard input (`stdin`). Returns
-- all values returned by the chunk. In case of errors, `dofile` propagates
-- the error to its caller (that is, `dofile` does not run in protected mode).
-function dofile(filename) end
+function dofile([filename]) end
---
-- Terminates the last protected function called and returns `message`
-- as the error message. Function `error` never returns.
+--
-- Usually, `error` adds some information about the error position at the
--- beginning of the message. The `level` argument specifies how to get the
--- error position. With level 1 (the default), the error position is where the
--- `error` function was called. Level 2 points the error to where the function
--- that called `error` was called; and so on. Passing a level 0 avoids the
--- addition of error position information to the message.
+-- beginning of the message, if the message is a string. The `level` argument
+-- specifies how to get the error position. With level 1 (the default), the
+-- error position is where the `error` function was called. Level 2 points the
+-- error to where the function that called `error` was called; and so on.
+-- Passing a level 0 avoids the addition of error position information to the
+-- message.
function error(message [, level]) end
-- * `_G._G`: A global variable (not a function) that holds the global
--- environment (that is, `_G._G = _G`). Lua itself does not use this variable;
--- changing its value does not affect any environment, nor vice-versa. (Use
--- `setfenv` to change environments.)
-
----
--- Returns the current environment in use by the function.
--- `f` can be a Lua function or a number that specifies the function at that
--- stack level: Level 1 is the function calling `getfenv`. If the given
--- function is not a Lua function, or if `f` is 0, `getfenv` returns the
--- global environment. The default for `f` is 1.
-function getfenv([f]) end
+-- environment (see §2.2). Lua itself does not use this variable; changing its
+-- value does not affect any environment, nor vice-versa.
---
-- If `object` does not have a metatable, returns nil. Otherwise, if the
@@ -60,35 +70,47 @@ function getfenv([f]) end
function getmetatable(object) end
---
--- Returns three values: an iterator function, the table `t`, and 0,
+-- If `t` has a metamethod `__ipairs`, calls it with `t` as argument and returns
+-- the first three results from the call.
+--
+-- Otherwise, returns three values: an iterator function, the table `t`, and 0,
-- so that the construction
+--
-- for i,v in ipairs(t) do *body* end
--- will iterate over the pairs (`1,t[1]`), (`2,t[2]`), ···, up to the
+--
+-- will iterate over the pairs (`1,t[1]`), (`2,t[2]`), ..., up to the
-- first integer key absent from the table.
function ipairs(t) end
---
--- Loads a chunk using function `func` to get its pieces. Each call to
--- `func` must return a string that concatenates with previous results. A
--- return of an empty string, nil, or no value signals the end of the chunk.
--- If there are no errors, returns the compiled chunk as a function; otherwise,
--- returns nil plus the error message. The environment of the returned function
--- is the global environment.
--- `chunkname` is used as the chunk name for error messages and debug
--- information. When absent, it defaults to "`=(load)`".
-function load(func [, chunkname]) end
+-- Loads a chunk.
+--
+-- If `ld` is a string, the chunk is this string. If `ld` is a function, `load`
+-- calls it repeatedly to get the chunk pieces. Each call to `ld` must return a
+-- string that concatenates with previous results. A return of an empty string,
+-- nil, or no value signals the end of the chunk.
+--
+-- If there are no syntactic errors, returns the compiled chunk as a function;
+-- otherwise, returns <b>nil</b> plus the error message.
+--
+-- If the resulting function has upvalues, the first upvalue is set to the value
+-- of the global environment or to `env`, if that parameter is given. When
+-- loading main chunks, the first upvalue will be the `_ENV` variable
+-- (see §2.2).
+--
+-- `source` is used as the source of the chunk for error messages and debug
+-- information (see §4.9). When absent, it defaults to `ld`, if `ld` is a
+-- string, or to "`=(load)`" otherwise.
+--
+-- The string `mode` controls whether the chunk can be text or binary (that is,
+-- a precompiled chunk). It may be the string "`b`" (only binary chunks), "`t`"
+-- (only text chunks), or "`bt`" (both binary and text). The default is "`bt`".
+function load(ld [, source [, mode [, env]]]) end
---
-- Similar to `load`, but gets the chunk from file `filename` or from the
-- standard input, if no file name is given.
-function loadfile([filename]) end
-
----
--- Similar to `load`, but gets the chunk from the given string.
--- To load and run a given string, use the idiom
--- assert(loadstring(s))()
--- When absent, `chunkname` defaults to the given string.
-function loadstring(string [, chunkname]) end
+function loadfile([filename [, mode [, env]]]) end
---
-- Allows a program to traverse all fields of a table. Its first argument is
@@ -98,19 +120,27 @@ function loadstring(string [, chunkname]) end
-- value. When called with the last index, or with nil in an empty table, `next`
-- returns nil. If the second argument is absent, then it is interpreted as
-- nil. In particular, you can use `next(t)` to check whether a table is empty.
+--
-- The order in which the indices are enumerated is not specified, *even for
-- numeric indices*. (To traverse a table in numeric order, use a numerical
--- for or the `ipairs` function.)
--- The behavior of `next` is *undefined* if, during the traversal, you assign
--- any value to a non-existent field in the table. You may however modify
--- existing fields. In particular, you may clear existing fields.
+-- `for`.)
+--
+-- The behavior of `next` is undefined if, during the traversal, you assign any
+-- value to a non-existent field in the table. You may however modify existing
+-- fields. In particular, you may clear existing fields.
function next(table [, index]) end
---
--- Returns three values: the `next` function, the table `t`, and nil,
+-- If `t` has a metamethod `__pairs`, calls it with `t` as argument and returns
+-- the first three results from the call.
+--
+-- Otherwise, returns three values: the `next` function, the table `t`, and nil,
-- so that the construction
+--
-- for k,v in pairs(t) do *body* end
+--
-- will iterate over all key–value pairs of table `t`.
+--
-- See function `next` for the caveats of modifying the table during its
-- traversal.
function pairs(t) end
@@ -122,13 +152,14 @@ function pairs(t) end
-- boolean), which is true if the call succeeds without errors. In such case,
-- `pcall` also returns all results from the call, after this first result. In
-- case of any error, `pcall` returns false plus the error message.
-function pcall(f, arg1, ···) end
+function pcall(f [, arg1, ···]) end
---
--- Receives any number of arguments, and prints their values to `stdout`,
--- using the `tostring` function to convert them to strings. `print` is not
+-- Receives any number of arguments and prints their values to `stdout`, using
+-- the `tostring` function to convert each argument to a string. `print` is not
-- intended for formatted output, but only as a quick way to show a value,
--- typically for debugging. For formatted output, use `string.format`.
+-- for instance for debugging. For complete control over the output, use
+-- `string.format` and `io.write`.
function print(···) end
---
@@ -142,54 +173,59 @@ function rawequal(v1, v2) end
function rawget(table, index) end
---
+-- Returns the length of the object `v`,
+-- which must be a table or a string,
+-- without invoking any metamethod.
+-- Returns an integer number.
+function rawlen(v) end
+
+---
-- Sets the real value of `table[index]` to `value`, without invoking any
--- metamethod. `table` must be a table, `index` any value different from nil,
--- and `value` any Lua value.
+-- metamethod. `table` must be a table, `index` any value different from nil and
+-- NaN, and `value` any Lua value.
+--
-- This function returns `table`.
function rawset(table, index, value) end
---
-- If `index` is a number, returns all arguments after argument number
--- `index`. Otherwise, `index` must be the string `"#"`, and `select` returns
--- the total number of extra arguments it received.
+-- `index`; a negative number indexes from the end (-1 is the last argument).
+-- Otherwise, `index` must be the string `"#"`, and `select` returns the total
+-- number of extra arguments it received.
function select(index, ···) end
---
--- Sets the environment to be used by the given function. `f` can be a Lua
--- function or a number that specifies the function at that stack level: Level
--- 1 is the function calling `setfenv`. `setfenv` returns the given function.
--- As a special case, when `f` is 0 `setfenv` changes the environment of the
--- running thread. In this case, `setfenv` returns no values.
-function setfenv(f, table) end
-
----
-- Sets the metatable for the given table. (You cannot change the metatable
-- of other types from Lua, only from C.) If `metatable` is nil, removes the
-- metatable of the given table. If the original metatable has a `"__metatable"`
-- field, raises an error.
+--
-- This function returns `table`.
function setmetatable(table, metatable) end
---
--- Tries to convert its argument to a number. If the argument is already
--- a number or a string convertible to a number, then `tonumber` returns this
--- number; otherwise, it returns nil.
--- An optional argument specifies the base to interpret the numeral. The base
--- may be any integer between 2 and 36, inclusive. In bases above 10, the
--- letter '`A`' (in either upper or lower case) represents 10, '`B`' represents
--- 11, and so forth, with '`Z`' representing 35. In base 10 (the default),
--- the number can have a decimal part, as well as an optional exponent part
--- (see §2.1). In other bases, only unsigned integers are accepted.
+-- When called with no `base`, `tonumber` tries to convert its argument to a
+-- number. If the argument is already a number or a string convertible to a
+-- number (see §3.4.2), then `tonumber` returns this number; otherwise, it
+-- returns nil.
+--
+-- When called with `base`, then `e` should be a string to be interpreted as an
+-- integer numeral in that base. The base may be any integer between 2 and 36,
+-- inclusive. In bases above 10, the letter '`A`' (in either upper or lower
+-- case) represents 10, '`B`' represents 11, and so forth, with '`Z`'
+-- representing 35. If the string `e` is not a valid numeral in the given base,
+-- the function returns nil
function tonumber(e [, base]) end
---
--- Receives an argument of any type and converts it to a string in a
--- reasonable format. For complete control of how numbers are converted, use
--- `string.format`.
--- If the metatable of `e` has a `"__tostring"` field, then `tostring` calls
--- the corresponding value with `e` as argument, and uses the result of the
--- call as its result.
-function tostring(e) end
+-- Receives a value of any type and converts it to a string in a reasonable
+-- format. (For complete control of how numbers are converted, use
+-- `string.format`.)
+--
+-- If the metatable of `v` has a `"__tostring"` field, then `tostring` calls the
+-- corresponding value with `v` as argument, and uses the result of the call as
+-- its result.
+function tostring(v) end
---
-- Returns the type of its only argument, coded as a string. The possible
@@ -198,29 +234,14 @@ function tostring(e) end
-- "`table`", "`function`", "`thread`", and "`userdata`".
function type(v) end
----
--- Returns the elements from the given table. This function is equivalent to
--- return list[i], list[i+1], ···, list[j]
--- except that the above code can be written only for a fixed number of
--- elements. By default, `i` is 1 and `j` is the length of the list, as
--- defined by the length operator (see §2.5.5).
-function unpack(list [, i [, j]]) end
-
-- * `_G._VERSION`: A global variable (not a function) that holds a string
-- containing the current interpreter version. The current contents of this
--- variable is "`Lua 5.1`".
+-- variable is "`Lua 5.2`".
---
--- This function is similar to `pcall`, except that you can set a new
--- error handler.
--- `xpcall` calls function `f` in protected mode, using `err` as the error
--- handler. Any error inside `f` is not propagated; instead, `xpcall` catches
--- the error, calls the `err` function with the original error object, and
--- returns a status code. Its first result is the status code (a boolean),
--- which is true if the call succeeds without errors. In this case, `xpcall`
--- also returns all results from the call, after this first result. In case
--- of any error, `xpcall` returns false plus the result from `err`.
-function xpcall(f, err) end
+-- This function is similar to `pcall`, except that it sets a new message
+-- handler `msgh`.
+function xpcall(f, msgh [, arg1, ···]) end
---
-- Creates a new coroutine, with body `f`. `f` must be a Lua
@@ -230,9 +251,10 @@ function coroutine.create(f) end
---
-- Starts or continues the execution of coroutine `co`. The first time
-- you resume a coroutine, it starts running its body. The values `val1`,
--- ··· are passed as the arguments to the body function. If the coroutine
--- has yielded, `resume` restarts it; the values `val1`, ··· are passed
+-- ... are passed as the arguments to the body function. If the coroutine
+-- has yielded, `resume` restarts it; the values `val1`, ... are passed
-- as the results from the yield.
+--
-- If the coroutine runs without any errors, `resume` returns true plus any
-- values passed to `yield` (if the coroutine yields) or any values returned
-- by the body function (if the coroutine terminates). If there is any error,
@@ -240,7 +262,8 @@ function coroutine.create(f) end
function coroutine.resume(co [, val1, ···]) end
---
--- Returns the running coroutine, or nil when called by the main thread.
+-- Returns the running coroutine plus a boolean, true when the running coroutine
+-- is the main one.
function coroutine.running() end
---
@@ -261,86 +284,118 @@ function coroutine.status(co) end
function coroutine.wrap(f) end
---
--- Suspends the execution of the calling coroutine. The coroutine cannot
--- be running a C function, a metamethod, or an iterator. Any arguments to
--- `yield` are passed as extra results to `resume`.
+-- Suspends the execution of the calling coroutine. Any arguments to `yield` are
+-- passed as extra results to `resume`.
function coroutine.yield(···) end
---
--- Creates a module. If there is a table in `package.loaded[name]`,
--- this table is the module. Otherwise, if there is a global table `t`
--- with the given name, this table is the module. Otherwise creates a new
--- table `t` and sets it as the value of the global `name` and the value of
--- `package.loaded[name]`. This function also initializes `t._NAME` with the
--- given name, `t._M` with the module (`t` itself), and `t._PACKAGE` with the
--- package name (the full module name minus last component; see below). Finally,
--- `module` sets `t` as the new environment of the current function and the
--- new value of `package.loaded[name]`, so that `require` returns `t`.
--- If `name` is a compound name (that is, one with components separated by
--- dots), `module` creates (or reuses, if they already exist) tables for each
--- component. For instance, if `name` is `a.b.c`, then `module` stores the
--- module table in field `c` of field `b` of global `a`.
--- This function can receive optional *options* after the module name, where
--- each option is a function to be applied over the module.
-function module(name [, ···]) end
-
----
-- Loads the given module. The function starts by looking into the
-- `package.loaded` table to determine whether `modname` is already
-- loaded. If it is, then `require` returns the value stored at
-- `package.loaded[modname]`. Otherwise, it tries to find a *loader* for
-- the module.
--- To find a loader, `require` is guided by the `package.loaders` array. By
--- changing this array, we can change how `require` looks for a module. The
+--
+-- To find a loader, `require` is guided by the `package.searchers` sequence. By
+-- changing this sequence, we can change how `require` looks for a module. The
-- following explanation is based on the default configuration for
--- `package.loaders`.
+-- `package.searchers`.
+--
-- First `require` queries `package.preload[modname]`. If it has a value,
-- this value (which should be a function) is the loader. Otherwise `require`
-- searches for a Lua loader using the path stored in `package.path`. If
-- that also fails, it searches for a C loader using the path stored in
-- `package.cpath`. If that also fails, it tries an *all-in-one* loader (see
--- `package.loaders`).
--- Once a loader is found, `require` calls the loader with a single argument,
--- `modname`. If the loader returns any value, `require` assigns the returned
--- value to `package.loaded[modname]`. If the loader returns no value and
+-- `package.searchers`).
+--
+-- Once a loader is found, `require` calls the loader with two arguments:
+-- `modname` and an extra value dependent on how it got the loader. (If the
+-- loader came from a file, this extra value is the file name.) If the loader
+-- returns any non-nil value, `require` assigns the returned value to
+-- `package.loaded[modname]`. If the loader does not return a non-nil value and
-- has not assigned any value to `package.loaded[modname]`, then `require`
--- assigns true to this entry. In any case, `require` returns the final value
--- of `package.loaded[modname]`.
+-- assigns <b>true</b> to this entry. In any case, `require` returns the final
+-- value of `package.loaded[modname]`.
+--
-- If there is any error loading or running the module, or if it cannot find
--- any loader for the module, then `require` signals an error.
+-- any loader for the module, then `require` raises an error.
function require(modname) end
+-- * `package.config`: A string describing some compile-time configurations for
+-- packages. This string is a sequence of lines:
+-- The first line is the directory separator string. Default is '`\`' for
+-- Windows and '`/`' for all other systems.
+-- The second line is the character that separates templates in a path.
+-- Default is '`;`'.
+-- The third line is the string that marks the substitution points in a
+-- template. Default is '`?`'.
+-- The fourth line is a string that, in a path in Windows, is replaced by
+-- the executable's directory. Default is '`!`'.
+-- The fifth line is a mark to ignore all text before it when building the
+-- `luaopen_` function name. Default is '`-`'.
+
-- * `package.cpath`: The path used by `require` to search for a C loader.
-- Lua initializes the C path `package.cpath` in the same way it initializes
--- the Lua path `package.path`, using the environment variable `LUA_CPATH`
--- or a default path defined in `luaconf.h`.
+-- the Lua path `package.path`, using the environment variable `LUA_CPATH_5_2`
+-- or the environment variable `LUA_CPATH` or a default path defined in
+-- `luaconf.h`.
-- * `package.loaded`: A table used by `require` to control which modules are
-- already loaded. When you require a module `modname` and
-- `package.loaded[modname]` is not false, `require` simply returns the value
-- stored there.
+-- This variable is only a reference to the real table; assignments to this
+-- variable do not change the table used by `require`.
+
+---
+-- Dynamically links the host program with the C library `libname`.
+--
+-- If `funcname` is "`*`", then it only links with the library, making the
+-- symbols exported by the library available to other dynamically linked
+-- libraries. Otherwise, it looks for a function `funcname` inside the library
+-- and returns this function as a C function. (So, `funcname` must follow the
+-- prototype `lua_CFunction`).
+--
+-- This is a low-level function. It completely bypasses the package and module
+-- system. Unlike `require`, it does not perform any path searching and does
+-- not automatically adds extensions. `libname` must be the complete file name
+-- of the C library, including if necessary a path and an extension. `funcname`
+-- must be the exact name exported by the C library (which may depend on the
+-- C compiler and linker used).
+--
+-- This function is not supported by Standard C. As such, it is only available
+-- on some platforms (Windows, Linux, Mac OS X, Solaris, BSD, plus other Unix
+-- systems that support the `dlfcn` standard).
+function package.loadlib(libname, funcname) end
--- * `package.loaders`: A table used by `require` to control how to load
--- modules. Each entry in this table is a *searcher function*. When looking
--- for a module, `require` calls each of these searchers in ascending order,
--- with the module name (the argument given to `require`) as its sole
--- parameter. The function can return another function (the module *loader*)
--- or a string explaining why it did not find that module (or nil if it has
--- nothing to say). Lua initializes this table with four functions.
+-- * `package.path`: The path used by `require` to search for a Lua loader.
+-- At start-up, Lua initializes this variable with the value of the
+-- environment variable `LUA_PATH_5_2` or the environment variable `LUA_PATH`
+-- or with a default path defined in `luaconf.h`, if those environment
+-- variables are not defined. Any "`;;`" in the value of the environment
+-- variable is replaced by the default path.
+
+-- * `package.preload`: A table to store loaders for specific modules (see
+-- `require`).
+-- This variable is only a reference to the real table; assignments to this
+-- variable do not change the table used by `require`.
+
+-- * `package.searchers`: A table used by `require` to control how to load
+-- modules.
+-- Each entry in this table is a *searcher function*. When looking for a
+-- module, `require` calls each of these searchers in ascending order, with
+-- the module name (the argument given to `require`) as its sole parameter.
+-- The function can return another function (the module *loader*) plus an
+-- extra value that will be passed to that loader, or a string explaining why
+-- it did not find that module (or nil if it has nothing to say).
+-- Lua initializes this table with four functions.
-- The first searcher simply looks for a loader in the `package.preload`
-- table.
-- The second searcher looks for a loader as a Lua library, using the path
--- stored at `package.path`. A path is a sequence of *templates* separated by
--- semicolons. For each template, the searcher will change each interrogation
--- mark in the template by `filename`, which is the module name with each dot
--- replaced by a "directory separator" (such as "`/`" in Unix); then it will
--- try to open the resulting file name. So, for instance, if the Lua path is
--- the string
--- "./?.lua;./?.lc;/usr/local/?/init.lua"
--- the search for a Lua file for module `foo` will try to open the files
--- `./foo.lua`, `./foo.lc`, and `/usr/local/foo/init.lua`, in that order.
+-- stored at `package.path`. The search is done as described in function
+-- `package.searchpath`.
-- The third searcher looks for a loader as a C library, using the path given
--- by the variable `package.cpath`. For instance, if the C path is the string
+-- by the variable `package.cpath`. Again, the search is done as described in
+-- function `package.searchpath`. For instance, if the C path is the string
-- "./?.so;./?.dll;/usr/local/?/init.so"
-- the searcher for module `foo` will try to open the files `./foo.so`,
-- `./foo.dll`, and `/usr/local/foo/init.so`, in that order. Once it finds
@@ -358,55 +413,48 @@ function require(modname) end
-- that would be `luaopen_a_b_c`. With this facility, a package can pack
-- several C submodules into one single library, with each submodule keeping
-- its original open function.
-
----
--- Dynamically links the host program with the C library `libname`. Inside
--- this library, looks for a function `funcname` and returns this function as a
--- C function. (So, `funcname` must follow the protocol (see `lua_CFunction`)).
--- This is a low-level function. It completely bypasses the package and module
--- system. Unlike `require`, it does not perform any path searching and does
--- not automatically adds extensions. `libname` must be the complete file name
--- of the C library, including if necessary a path and extension. `funcname`
--- must be the exact name exported by the C library (which may depend on the
--- C compiler and linker used).
--- This function is not supported by ANSI C. As such, it is only available
--- on some platforms (Windows, Linux, Mac OS X, Solaris, BSD, plus other Unix
--- systems that support the `dlfcn` standard).
-function package.loadlib(libname, funcname) end
-
--- * `package.path`: The path used by `require` to search for a Lua loader.
--- At start-up, Lua initializes this variable with the value of the
--- environment variable `LUA_PATH` or with a default path defined in
--- `luaconf.h`, if the environment variable is not defined. Any "`;;`" in the
--- value of the environment variable is replaced by the default path.
-
--- * `package.preload`: A table to store loaders for specific modules (see
--- `require`).
-
----
--- Sets a metatable for `module` with its `__index` field referring to the
--- global environment, so that this module inherits values from the global
--- environment. To be used as an option to function `module`.
-function package.seeall(module) end
+-- All searchers except the first one (preload) return as the extra value the
+-- file name where the module was found, as returned by `package.searchpath`.
+-- The first searcher returns no extra value.
+
+---
+-- Searches for the given `name` in the given `path`.
+--
+-- A path is a string containing a sequence of _templates_ separated by
+-- semicolons. For each template, the function replaces each interrogation mark
+-- (if any) in the template with a copy of `name` wherein all occurrences of
+-- `sep` (a dot, by default) were replaced by `rep` (the system's directory
+-- separator, by default), and then tries to open the resulting file name.
+-- For instance, if the path is the string
+-- "./?.lua;./?.lc;/usr/local/?/init.lua"
+-- the search for the name `foo.a` will try to open the files `./foo/a.lua`,
+-- `./foo/a.lc`, and `/usr/local/foo/a/init.lua`, in that order.
+-- Returns the resulting name of the first file that it can open in read mode
+-- (after closing the file), or nil plus an error message if none succeeds.
+-- (This error message lists all file names it tried to open.)
+function package.searchpath(name, path [, sep [, rep]]) end
---
-- Returns the internal numerical codes of the characters `s[i]`, `s[i+1]`,
--- ···, `s[j]`. The default value for `i` is 1; the default value for `j`
--- is `i`.
--- Note that numerical codes are not necessarily portable across platforms.
+-- ..., `s[j]`. The default value for `i` is 1; the default value for `j`
+-- is `i`. These indices are corrected following the same rules of function
+-- `string.sub`.
+--
+-- Numerical codes are not necessarily portable across platforms.
function string.byte(s [, i [, j]]) end
---
-- Receives zero or more integers. Returns a string with length equal to
-- the number of arguments, in which each character has the internal numerical
-- code equal to its corresponding argument.
--- Note that numerical codes are not necessarily portable across platforms.
+--
+-- Numerical codes are not necessarily portable across platforms.
function string.char(···) end
---
-- Returns a string containing a binary representation of the given
--- function, so that a later `loadstring` on this string returns a copy of
--- the function. `function` must be a Lua function without upvalues.
+-- function, so that a later `load` on this string returns a copy of the
+-- function (but with new upvalues).
function string.dump(function) end
---
@@ -417,50 +465,62 @@ function string.dump(function) end
-- can be negative. A value of true as a fourth, optional argument `plain`
-- turns off the pattern matching facilities, so the function does a plain
-- "find substring" operation, with no characters in `pattern` being considered
--- "magic". Note that if `plain` is given, then `init` must be given as well.
+-- magic. Note that if `plain` is given, then `init` must be given as well.
+--
-- If the pattern has captures, then in a successful match the captured values
-- are also returned, after the two indices.
function string.find(s, pattern [, init [, plain]]) end
---
--- Returns a formatted version of its variable number of arguments following
--- the description given in its first argument (which must be a string). The
--- format string follows the same rules as the `printf` family of standard C
--- functions. The only differences are that the options/modifiers `*`, `l`,
--- `L`, `n`, `p`, and `h` are not supported and that there is an extra option,
--- `q`. The `q` option formats a string in a form suitable to be safely read
--- back by the Lua interpreter: the string is written between double quotes,
--- and all double quotes, newlines, embedded zeros, and backslashes in the
--- string are correctly escaped when written. For instance, the call
+-- Returns a formatted version of its variable number of arguments following the
+-- description given in its first argument (which must be a string). The format
+-- string follows the same rules as the C function `sprintf`. The only
+-- differences are that the options/modifiers `*`, `h`, `L`, `l`, `n`, and `p`
+-- are not supported and that there is an extra option, `q`. The `q` option
+-- formats a string between double quotes, using escape sequences when necessary
+-- to ensure that it can safely be read back by the Lua interpreter. For
+-- instance, the call
+--
-- string.format('%q', 'a string with "quotes" and \n new line')
--- will produce the string:
+--
+-- may produce the string:
+--
-- "a string with \"quotes\" and \
-- new line"
--- The options `c`, `d`, `E`, `e`, `f`, `g`, `G`, `i`, `o`, `u`, `X`, and
--- `x` all expect a number as argument, whereas `q` and `s` expect a string.
--- This function does not accept string values containing embedded zeros,
--- except as arguments to the `q` option.
+--
+-- Options `A` and `a` (when available), `E`, `e`, `f`, `G`, and `g` all expect
+-- a number as argument. Options `c`, `d`, `i`, `o`, `u`, `X`, and `x` also
+-- expect a number, but the range of that number may be limited by the
+-- underlying C implementation. For options `o`, `u`, `X`, and `x`, the number
+-- cannot be negative. Option `q` expects a string; option `s` expects a string
+-- without embedded zeros. If the argument to option `s` is not a string, it is
+-- converted to one following the same rules of `tostring`.
function string.format(formatstring, ···) end
---
-- Returns an iterator function that, each time it is called, returns the
--- next captures from `pattern` over string `s`. If `pattern` specifies no
+-- next captures from `pattern` over the string `s`. If `pattern` specifies no
-- captures, then the whole match is produced in each call.
--- As an example, the following loop
+--
+-- As an example, the following loop will iterate over all the words from string
+-- `s`, printing one per line:
+--
-- s = "hello world from Lua"
-- for w in string.gmatch(s, "%a+") do
-- print(w)
-- end
--- will iterate over all the words from string `s`, printing one per line. The
--- next example collects all pairs `key=value` from the given string into
--- a table:
+--
+-- The next example collects all pairs `key=value` from the given string into a
+-- table:
+--
-- t = {}
-- s = "from=world, to=Lua"
-- for k, v in string.gmatch(s, "(%w+)=(%w+)") do
-- t[k] = v
-- end
--- For this function, a '`^`' at the start of a pattern does not work as an
--- anchor, as this would prevent the iteration.
+--
+-- For this function, a caret '`^`' at the start of a pattern does not work as
+-- an anchor, as this would prevent the iteration.
function string.gmatch(s, pattern) end
---
@@ -468,11 +528,14 @@ function string.gmatch(s, pattern) end
-- occurrences of the `pattern` have been replaced by a replacement string
-- specified by `repl`, which can be a string, a table, or a function. `gsub`
-- also returns, as its second value, the total number of matches that occurred.
+-- The name `gsub` comes from "Global SUBstitution".
+--
-- If `repl` is a string, then its value is used for replacement. The character
--- `%` works as an escape character: any sequence in `repl` of the form `%n`,
--- with *n* between 1 and 9, stands for the value of the *n*-th captured
+-- `%` works as an escape character: any sequence in `repl` of the form `%d`,
+-- with `d` between 1 and 9, stands for the value of the `d`-th captured
-- substring (see below). The sequence `%0` stands for the whole match. The
-- sequence `%%` stands for a single `%`.
+--
-- If `repl` is a table, then the table is queried for every match, using
-- the first capture as the key; if the pattern specifies no captures, then
-- the whole match is used as the key.
@@ -480,11 +543,14 @@ function string.gmatch(s, pattern) end
-- occurs, with all captured substrings passed as arguments, in order; if
-- the pattern specifies no captures, then the whole match is passed as a
-- sole argument.
+--
-- If the value returned by the table query or by the function call is a
-- string or a number, then it is used as the replacement string; otherwise,
-- if it is false or nil, then there is no replacement (that is, the original
-- match is kept in the string).
+--
-- Here are some examples:
+--
-- x = string.gsub("hello world", "(%w+)", "%1 %1")
-- --> x="hello hello world world"
-- x = string.gsub("hello world", "%w+", "%0 %0", 1)
@@ -494,12 +560,12 @@ function string.gmatch(s, pattern) end
-- x = string.gsub("home = $HOME, user = $USER", "%$(%w+)", os.getenv)
-- --> x="home = /home/roberto, user = roberto"
-- x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s)
--- return loadstring(s)()
+-- return load(s)()
-- end)
-- --> x="4+5 = 9"
--- local t = {name="lua", version="5.1"}
+-- local t = {name="lua", version="5.2"}
-- x = string.gsub("$name-$version.tar.gz", "%$(%w+)", t)
--- --> x="lua-5.1.tar.gz"
+-- --> x="lua-5.2.tar.gz"
function string.gsub(s, pattern, repl [, n]) end
---
@@ -522,9 +588,10 @@ function string.lower(s) end
function string.match(s, pattern [, init]) end
---
--- Returns a string that is the concatenation of `n` copies of the string
--- `s`.
-function string.rep(s, n) end
+-- Returns a string that is the concatenation of `n` copies of the string `s`
+-- separated by the string `sep`. The default value for `sep` is the empty
+-- string (that is, no separator).
+function string.rep(s, n [, sep]) end
---
-- Returns a string that is the string `s` reversed.
@@ -536,6 +603,11 @@ function string.reverse(s) end
-- be equal to -1 (which is the same as the string length). In particular,
-- the call `string.sub(s,1,j)` returns a prefix of `s` with length `j`, and
-- `string.sub(s, -i)` returns a suffix of `s` with length `i`.
+--
+-- If, after the translation of negative indices, `i` is less than 1, it is
+-- corrected to 1. If `j` is greater than the string length, it is corrected to
+-- that length. If, after these corrections, `i` is greater than `j`, the
+-- function returns the empty string.
function string.sub(s, i [, j]) end
---
@@ -545,44 +617,52 @@ function string.sub(s, i [, j]) end
function string.upper(s) end
---
--- Given an array where all elements are strings or numbers, returns
--- `table[i]..sep..table[i+1] ··· sep..table[j]`. The default value for
--- `sep` is the empty string, the default for `i` is 1, and the default for
--- `j` is the length of the table. If `i` is greater than `j`, returns the
--- empty string.
-function table.concat(table [, sep [, i [, j]]]) end
+-- Given a list where all elements are strings or numbers, returns
+-- `list[i]..sep..list[i+1] ··· sep..list[j]`. The default value for `sep` is
+-- the empty string, the default for `i` is 1, and the default for `j` is
+-- `#list`. If `i` is greater than `j`, returns the empty string.
+function table.concat(list [, sep [, i [, j]]]) end
---
--- Inserts element `value` at position `pos` in `table`, shifting up
--- other elements to open space, if necessary. The default value for `pos` is
--- `n+1`, where `n` is the length of the table (see §2.5.5), so that a call
--- `table.insert(t,x)` inserts `x` at the end of table `t`.
-function table.insert(table, [pos,] value) end
+-- Inserts element `value` at position `pos` in `list`, shifting up the elements
+-- `list[pos], list[pos+1], ···, list[#list]`. The default value for `pos` is
+-- `#list+1`, so that a call `table.insert(t,x)` inserts `x` at the end of list
+-- `t`.
+function table.insert(list, [pos,] value) end
---
--- Returns the largest positive numerical index of the given table, or
--- zero if the table has no positive numerical indices. (To do its job this
--- function does a linear traversal of the whole table.)
-function table.maxn(table) end
+-- Returns a new table with all parameters stored into keys 1, 2, etc. and with
+-- a field "`n`" with the total number of parameters. Note that the resulting
+-- table may not be a sequence.
+function table.pack(···) end
---
--- Removes from `table` the element at position `pos`, shifting down other
--- elements to close the space, if necessary. Returns the value of the removed
--- element. The default value for `pos` is `n`, where `n` is the length of the
--- table, so that a call `table.remove(t)` removes the last element of table
--- `t`.
-function table.remove(table [, pos]) end
+-- Removes from `list` the element at position `pos`, shifting down the elements
+-- `list[pos+1], list[pos+2], ···, list[#list]` and erasing element
+-- `list[#list]`. Returns the value of the removed element. The default value
+-- for `pos` is `#list`, so that a call `table.remove(t)` removes the last
+-- element of list `t`.
+function table.remove(list [, pos]) end
---
--- Sorts table elements in a given order,
--- *in-place*, from `table[1]` to `table[n]`, where `n` is the length of the
--- table. If `comp` is given, then it must be a function that receives two
--- table elements, and returns true when the first is less than the second
--- (so that `not comp(a[i+1],a[i])` will be true after the sort). If `comp`
--- is not given, then the standard Lua operator `<` is used instead.
+-- Sorts list elements in a given order, *in-place*, from `list[1]` to
+-- `list[#list]`. If `comp` is given, then it must be a function that receives
+-- two list elements and returns true when the first element must come before
+-- the second in the final order (so that `not comp(list[i+1],list[i])` will be
+-- true after the sort). If `comp` is not given, then the standard Lua operator
+-- `<` is used instead.
+--
-- The sort algorithm is not stable; that is, elements considered equal by the
-- given order may have their relative positions changed by the sort.
-function table.sort(table [, comp]) end
+function table.sort(list [, comp]) end
+
+---
+-- Returns the elements from the given table. This function is equivalent to
+--
+-- return list[i], list[i+1], ···, list[j]
+--
+-- By default, `i` is 1 and `j` is `#list`.
+function table.unpack(list [, i [, j]]) end
---
-- Returns the absolute value of `x`.
@@ -636,7 +716,7 @@ function math.floor(x) end
function math.fmod(x, y) end
---
--- Returns `m` and `e` such that *x = m2^e*, `e` is an integer and the
+-- Returns `m` and `e` such that 'x = m2^e', `e` is an integer and the
-- absolute value of `m` is in the range *[0.5, 1)* (or zero when `x` is zero).
function math.frexp(x) end
@@ -644,16 +724,13 @@ function math.frexp(x) end
-- other numerical value.
---
--- Returns *m2^e* (`e` should be an integer).
+-- Returns 'm2^e' (`e` should be an integer).
function math.ldexp(m, e) end
---
--- Returns the natural logarithm of `x`.
-function math.log(x) end
-
----
--- Returns the base-10 logarithm of `x`.
-function math.log10(x) end
+-- Returns the logarithm of `x` in the given base. The default for `base` is 'e'
+-- (so that the function returns the natural logarithm of `x`).
+function math.log(x [, base]) end
---
-- Returns the maximum value among its arguments.
@@ -668,7 +745,7 @@ function math.min(x, ···) end
-- `x`.
function math.modf(x) end
--- * `math.pi`: The value of *pi*.
+-- * `math.pi`: The value of 'Ï€'.
---
-- Returns *x^y*. (You can also use the expression `x^y` to compute this
@@ -681,13 +758,14 @@ function math.rad(x) end
---
-- This function is an interface to the simple pseudo-random generator
--- function `rand` provided by ANSI C. (No guarantees can be given for its
+-- function `rand` provided by Standard C. (No guarantees can be given for its
-- statistical properties.)
+--
-- When called without arguments, returns a uniform pseudo-random real
--- number in the range *[0,1)*. When called with an integer number `m`,
--- `math.random` returns a uniform pseudo-random integer in the range *[1,
--- m]*. When called with two integer numbers `m` and `n`, `math.random`
--- returns a uniform pseudo-random integer in the range *[m, n]*.
+-- number in the range [0,1). When called with an integer number `m`,
+-- `math.random` returns a uniform pseudo-random integer in the range [1, m].
+-- When called with two integer numbers `m` and `n`, `math.random` returns a
+-- uniform pseudo-random integer in the range [m, n].
function math.random([m [, n]]) end
---
@@ -717,12 +795,108 @@ function math.tan(x) end
function math.tanh(x) end
---
+-- Returns the number `x` shifted `disp` bits to the right. The number `disp`
+-- may be any representable integer. Negative displacements shift to the left.
+--
+-- This shift operation is what is called arithmetic shift. Vacant bits on the
+-- left are filled with copies of the higher bit of `x`; vacant bits on the
+-- right are filled with zeros. In particular, displacements with absolute
+-- values higher than 31 result in zero or `0xFFFFFFFF` (all original bits are
+-- shifted out).
+function bit32.arshift(x, disp) end
+
+---
+-- Returns the bitwise "and" of its operands.
+function bit32.band(...) end
+
+---
+-- Returns the bitwise negation of `x`. For any integer `x`, the following
+-- identity holds:
+--
+-- assert(bit32.bnot(x) == (-1 - x) % 2^32)
+function bit32.bnot(x) end
+
+---
+-- Returns the bitwise "or" of its operands.
+function bit32.bor(...) end
+
+---
+-- Returns a boolean signaling whether the bitwise "and" of its operands is
+-- different from zero.
+function bit32.btest(...) end
+
+---
+-- Returns the bitwise "exclusive or" of its operands.
+function bit32.xor(...) end
+
+---
+-- Returns the unsigned number formed by the bits `field` to `field + width - 1`
+-- from `n`. Bits are numbered from 0 (least significant) to 31 (most
+-- significant). All accessed bits must be in the range [0, 31].
+--
+-- The default for `width` is 1.
+function bit32.extract(n, field [, width]) end
+
+---
+-- Returns a copy of `n` with the bits `field` to `field + width - 1` replaced
+-- by the value `v`. See `bit32.extract` for details about `field` and `width`.
+function bit32.replace(n, v, field [, width]) end
+
+---
+-- Returns the number `x` rotated `disp` bits to the left. The number `disp` may
+-- be any representable integer.
+--
+-- For any valid displacement, the following identity holds:
+--
+-- assert(bit32.lrotate(x, disp) == bit32.lrotate(x, disp % 32))
+--
+-- In particular, negative displacements rotate to the right.
+function bit32.lrotate(x, disp) end
+
+---
+-- Returns the number `x` shifted `disp` bits to the left. The number `disp` may
+-- be any representable integer. Negative displacements shift to the right. In
+-- any direction, vacant bits are filled with zeros. In particular,
+-- displacements with absolute values higher than 31 result in zero (all bits
+-- are shifted out).
+--
+-- For positive displacements, the following equality holds:
+--
+-- assert(bit32.lshift(b, disp) == (b * 2^disp) % 2^32)
+function bit32.lshift(x, disp) end
+
+---
+-- Returns the number `x` rotated `disp` bits to the right. The number `disp`
+-- may be any representable integer.
+--
+-- For any valid displacement, the following identity holds:
+--
+-- assert(bit32.rrotate(x, disp) == bit32.rrotate(x, disp % 32))
+--
+-- In particular, negative displacements rotate to the left.
+function bit32.rrotate(x, disp) end
+
+---
+-- Returns the number `x` shifted `disp` bits to the right. The number `disp`
+-- may be any representable integer. Negative displacements shift to the left.
+-- In any direction, vacant bits are filled with zeros. In particular,
+-- displacements with absolute values higher than 31 result in zero (all bits
+-- are shifted out).
+--
+-- For positive displacements, the following equality holds:
+--
+-- assert(bit32.rshift(b, disp) == math.floor(b % 2^32 / 2^disp))
+--
+-- This shift operation is what is called logical shift.
+function bit32.rshift(x, disp) end
+
+---
-- Equivalent to `file:close()`. Without a `file`, closes the default
-- output file.
function io.close([file]) end
---
--- Equivalent to `file:flush` over the default output file.
+-- Equivalent to `io.output():flush()`.
function io.flush() end
---
@@ -730,26 +904,29 @@ function io.flush() end
-- and sets its handle as the default input file. When called with a file
-- handle, it simply sets this file handle as the default input file. When
-- called without parameters, it returns the current default input file.
+--
-- In case of errors this function raises the error, instead of returning an
-- error code.
function io.input([file]) end
---
--- Opens the given file name in read mode and returns an iterator function
--- that, each time it is called, returns a new line from the file. Therefore,
--- the construction
--- for line in io.lines(filename) do *body* end
--- will iterate over all lines of the file. When the iterator function detects
--- the end of file, it returns nil (to finish the loop) and automatically
--- closes the file.
+-- Opens the given file name in read mode and returns an iterator function that
+-- works like `file:lines(···)` over the opened file. When the iterator function
+-- detects -- the end of file, it returns nil (to finish the loop) and
+-- automatically closes the file.
+--
-- The call `io.lines()` (with no file name) is equivalent to
-- `io.input():lines()`; that is, it iterates over the lines of the default
-- input file. In this case it does not close the file when the loop ends.
-function io.lines([filename]) end
+--
+-- In case of errors this function raises the error, instead of returning an
+-- error code.
+function io.lines([filename ···]) end
---
-- This function opens a file, in the mode specified in the string `mode`. It
-- returns a new file handle, or, in case of errors, nil plus an error message.
+--
-- The `mode` string can be any of the following:
-- "r": read mode (the default);
-- "w": write mode;
@@ -757,10 +934,10 @@ function io.lines([filename]) end
-- "r+": update mode, all previous data is preserved;
-- "w+": update mode, all previous data is erased;
-- "a+": append update mode, previous data is preserved, writing is only
--- allowed at the end of file.
+-- allowed at the end of file.
+--
-- The `mode` string can also have a '`b`' at the end, which is needed in
--- some systems to open the file in binary mode. This string is exactly what
--- is used in the standard C function `fopen`.
+-- some systems to open the file in binary mode.
function io.open(filename [, mode]) end
---
@@ -771,11 +948,12 @@ function io.output([file]) end
-- Starts program `prog` in a separated process and returns a file handle
-- that you can use to read data from this program (if `mode` is `"r"`,
-- the default) or to write data to this program (if `mode` is `"w"`).
+--
-- This function is system dependent and is not available on all platforms.
function io.popen(prog [, mode]) end
---
--- Equivalent to `io.input():read`.
+-- Equivalent to `io.input():read(···)`.
function io.read(···) end
-- * `io.stderr`: Standard error.
@@ -794,13 +972,16 @@ function io.tmpfile() end
function io.type(obj) end
---
--- Equivalent to `io.output():write`.
+-- Equivalent to `io.output():write(···)`.
function io.write(···) end
---
-- Closes `file`. Note that files are automatically closed when their
-- handles are garbage collected, but that takes an unpredictable amount of
-- time to happen.
+--
+-- When closing a file handle created with `io.popen`, `file:close` returns the
+-- same values returned by `os.execute`.
function file:close() end
---
@@ -808,29 +989,39 @@ function file:close() end
function file:flush() end
---
--- Returns an iterator function that, each time it is called, returns a
--- new line from the file. Therefore, the construction
--- for line in file:lines() do *body* end
--- will iterate over all lines of the file. (Unlike `io.lines`, this function
--- does not close the file when the loop ends.)
-function file:lines() end
+-- Returns an iterator function that, each time it is called, reads the file
+-- according to the given formats. When no format is given, uses "*l" as a
+-- default. As an example, the construction
+--
+-- for c in file:lines(1) do <em>body</em> end
+--
+-- will iterate over all characters of the file, starting at the current
+-- position. Unlike `io.lines`, this function does not close the file when the
+-- loop ends.
+--
+-- In case of errors this function raises the error, instead of returning an
+-- error code.
+function file:lines(···) end
---
-- Reads the file `file`, according to the given formats, which specify
-- what to read. For each format, the function returns a string (or a number)
-- with the characters read, or nil if it cannot read data with the specified
-- format. When called without formats, it uses a default format that reads
--- the entire next line (see below).
+-- the next line (see below).
+--
-- The available formats are
-- "*n": reads a number; this is the only format that returns a number
--- instead of a string.
+-- instead of a string.
-- "*a": reads the whole file, starting at the current position. On end of
--- file, it returns the empty string.
--- "*l": reads the next line (skipping the end of line), returning nil on
--- end of file. This is the default format.
--- *number*: reads a string with up to this number of characters, returning
--- nil on end of file. If number is zero, it reads nothing and returns an
--- empty string, or nil on end of file.
+-- file, it returns the empty string.
+-- "*l": reads the next line skipping the end of line, returning nil on
+-- end of file. This is the default format.
+-- "*L": reads the next line keeping the end of line (if present), returning
+-- nil on end of file.
+-- *number*: reads a string with up to this number of bytes, returning nil on
+-- end of file. If number is zero, it reads nothing and returns an empty
+-- string, or nil on end of file.
function file:read(···) end
---
@@ -840,32 +1031,39 @@ function file:read(···) end
-- "set": base is position 0 (beginning of the file);
-- "cur": base is current position;
-- "end": base is end of file;
+--
-- In case of success, function `seek` returns the final file position,
--- measured in bytes from the beginning of the file. If this function fails,
--- it returns nil, plus a string describing the error.
+-- measured in bytes from the beginning of the file. If `seek` fails, it returns
+-- nil, plus a string describing the error.
+--
-- The default value for `whence` is `"cur"`, and for `offset` is 0. Therefore,
-- the call `file:seek()` returns the current file position, without changing
-- it; the call `file:seek("set")` sets the position to the beginning of the
-- file (and returns 0); and the call `file:seek("end")` sets the position
-- to the end of the file, and returns its size.
-function file:seek([whence] [, offset]) end
+function file:seek([whence [, offset]]) end
---
-- Sets the buffering mode for an output file. There are three available
-- modes:
-- "no": no buffering; the result of any output operation appears immediately.
-- "full": full buffering; output operation is performed only when the
--- buffer is full (or when you explicitly `flush` the file (see `io.flush`)).
+-- buffer is full or when you explicitly `flush` the file (see
+-- `io.flush`).
-- "line": line buffering; output is buffered until a newline is output or
--- there is any input from some special files (such as a terminal device).
+-- there is any input from some special files (such as a terminal
+-- device).
+--
-- For the last two cases, `size` specifies the size of the buffer, in
-- bytes. The default is an appropriate size.
function file:setvbuf(mode [, size]) end
---
--- Writes the value of each of its arguments to the `file`. The arguments
--- must be strings or numbers. To write other values, use `tostring` or
--- `string.format` before `write`.
+-- Writes the value of each of its arguments to `file`. The arguments must be
+-- strings or numbers.
+--
+-- In case of success, this function returns `file`. Otherwise it returns nil
+-- plus a string describing the error.
function file:write(···) end
---
@@ -876,20 +1074,27 @@ function os.clock() end
---
-- Returns a string or a table containing date and time, formatted according
-- to the given string `format`.
+--
-- If the `time` argument is present, this is the time to be formatted
-- (see the `os.time` function for a description of this value). Otherwise,
-- `date` formats the current time.
+--
-- If `format` starts with '`!`', then the date is formatted in Coordinated
-- Universal Time. After this optional character, if `format` is the string
-- "`*t`", then `date` returns a table with the following fields: `year` (four
--- digits), `month` (1--12), `day` (1--31), `hour` (0--23), `min` (0--59),
--- `sec` (0--61), `wday` (weekday, Sunday is 1), `yday` (day of the year),
--- and `isdst` (daylight saving flag, a boolean).
+-- digits), `month` (1-12), `day` (1-31), `hour` (0-23), `min` (0-59), `sec`
+-- (0-61), `wday` (weekday, Sunday is 1), `yday` (day of the year), and `isdst`
+-- (daylight saving flag, a boolean). This last field may be absent if the
+-- information is not available.
+--
-- If `format` is not "`*t`", then `date` returns the date as a string,
-- formatted according to the same rules as the C function `strftime`.
+--
-- When called without arguments, `date` returns a reasonable date and time
-- representation that depends on the host system and on the current locale
-- (that is, `os.date()` is equivalent to `os.date("%c")`).
+--
+-- On some systems, this function may be not thread safe.
function os.date([format [, time]]) end
---
@@ -899,15 +1104,27 @@ function os.difftime(t2, t1) end
---
-- This function is equivalent to the C function `system`. It passes
--- `command` to be executed by an operating system shell. It returns a status
--- code, which is system-dependent. If `command` is absent, then it returns
--- nonzero if a shell is available and zero otherwise.
+-- `command` to be executed by an operating system shell. Its first result is
+-- `true` if the command terminated successfully, or `nil` otherwise. After this
+-- first result the function returns a string and a number, as follows:
+-- "exit": the command terminated normally; the following number is the exit
+-- status of the command.
+-- "signal": the command was terminated by a signal; the following number is
+-- the signal that terminated the command.
+--
+-- When called without a `command`, `os.execute` returns a boolean that is true
+-- if a shell is available.
function os.execute([command]) end
---
--- Calls the C function `exit`, with an optional `code`, to terminate the
--- host program. The default value for `code` is the success code.
-function os.exit([code]) end
+-- Calls the C function `exit` to terminate the host program. If `code` is
+-- `true`, the returned status is `EXIT_SUCCESS`; if `code` is `false`, the
+-- returned status is `EXIT_FAILURE`; if `code` is a number, the returned status
+-- is this number. The default value for `code` is `true`.
+--
+-- If the optional second argument `close` is true, closes the Lua state before
+-- exiting.
+function os.exit([code [, close]]) end
---
-- Returns the value of the process environment variable `varname`, or
@@ -915,25 +1132,27 @@ function os.exit([code]) end
function os.getenv(varname) end
---
--- Deletes the file or directory with the given name. Directories must be
--- empty to be removed. If this function fails, it returns nil, plus a string
--- describing the error.
+-- Deletes the file (or empty directory, on POSIX systems) with the given name.
+-- If this function fails, it returns nil, plus a string describing the error
+-- and the error code.
function os.remove(filename) end
---
-- Renames file or directory named `oldname` to `newname`. If this function
--- fails, it returns nil, plus a string describing the error.
+-- fails, it returns nil, plus a string describing the error and the error code.
function os.rename(oldname, newname) end
---
--- Sets the current locale of the program. `locale` is a string specifying
--- a locale; `category` is an optional string describing which category to
--- change: `"all"`, `"collate"`, `"ctype"`, `"monetary"`, `"numeric"`, or
--- `"time"`; the default category is `"all"`. The function returns the name
--- of the new locale, or nil if the request cannot be honored.
+-- Sets the current locale of the program. `locale` is a system-dependent string
+-- specifying a locale; `category` is an optional string describing which
+-- category to change: `"all"`, `"collate"`, `"ctype"`, `"monetary"`,
+-- `"numeric"`, or `"time"`; the default category is `"all"`. The function
+-- returns the name of the new locale, or nil if the request cannot be honored.
+--
-- If `locale` is the empty string, the current locale is set to an
-- implementation-defined native locale. If `locale` is the string "`C`",
-- the current locale is set to the standard C locale.
+--
-- When called with nil as the first argument, this function only returns
-- the name of the current locale for the given category.
function os.setlocale(locale [, category]) end
@@ -941,25 +1160,28 @@ function os.setlocale(locale [, category]) end
---
-- Returns the current time when called without arguments, or a time
-- representing the date and time specified by the given table. This table
--- must have fields `year`, `month`, and `day`, and may have fields `hour`,
--- `min`, `sec`, and `isdst` (for a description of these fields, see the
--- `os.date` function).
+-- must have fields `year`, `month`, and `day`, and may have fields `hour`
+-- (default is 12), `min` (default is 0), `sec` (default is 0), and `isdst`
+-- (default is nil). For a description of these fields, see the `os.date`
+-- function.
+--
-- The returned value is a number, whose meaning depends on your system. In
--- POSIX, Windows, and some other systems, this number counts the number
--- of seconds since some given start time (the "epoch"). In other systems,
--- the meaning is not specified, and the number returned by `time` can be
--- used only as an argument to `date` and `difftime`.
+-- POSIX, Windows, and some other systems, this number counts the number of
+-- seconds since some given start time (the "epoch"). In other systems, the
+-- meaning is not specified, and the number returned by `time` can be used only
+-- as an argument to `os.date` and `os.difftime`.
function os.time([table]) end
---
-- Returns a string with a file name that can be used for a temporary
-- file. The file must be explicitly opened before its use and explicitly
-- removed when no longer needed.
--- On some systems (POSIX), this function also creates a file with that
--- name, to avoid security risks. (Someone else might create the file with
--- wrong permissions in the time between getting the name and creating the
--- file.) You still have to open the file to use it and to remove it (even
--- if you do not use it).
+--
+-- On POSIX systems, this function also creates a file with that name, to avoid
+-- security risks. (Someone else might create the file with wrong permissions in
+-- the time between getting the name and creating the file.) You still have to
+-- open the file to use it and to remove it (even if you do not use it).
+--
-- When possible, you may prefer to use `io.tmpfile`, which automatically
-- removes the file when the program ends.
function os.tmpname() end
@@ -970,15 +1192,12 @@ function os.tmpname() end
-- the user can inspect global and local variables, change their values,
-- evaluate expressions, and so on. A line containing only the word `cont`
-- finishes this function, so that the caller continues its execution.
+--
-- Note that commands for `debug.debug` are not lexically nested within any
--- function, and so have no direct access to local variables.
+-- function and so have no direct access to local variables.
function debug.debug() end
---
--- Returns the environment of object `o`.
-function debug.getfenv(o) end
-
----
-- Returns the current hook settings of the thread, as three values: the
-- current hook function, the current hook mask, and the current hook count
-- (as set by the `debug.sethook` function).
@@ -986,74 +1205,83 @@ function debug.gethook([thread]) end
---
-- Returns a table with information about a function. You can give the
--- function directly, or you can give a number as the value of `function`,
--- which means the function running at level `function` of the call stack
--- of the given thread: level 0 is the current function (`getinfo` itself);
--- level 1 is the function that called `getinfo`; and so on. If `function`
--- is a number larger than the number of active functions, then `getinfo`
--- returns nil.
+-- function directly or you can give a number as the value of `f`, which means
+-- the function running at level `f` of the call stack of the given thread:
+-- level 0 is the current function (`getinfo` itself); level 1 is the function
+-- that called `getinfo` and so on. If `f` is a number larger than the number of
+-- active functions, then `getinfo` returns nil.
+--
-- The returned table can contain all the fields returned by `lua_getinfo`,
-- with the string `what` describing which fields to fill in. The default for
-- `what` is to get all information available, except the table of valid
-- lines. If present, the option '`f`' adds a field named `func` with
-- the function itself. If present, the option '`L`' adds a field named
-- `activelines` with the table of valid lines.
+--
-- For instance, the expression `debug.getinfo(1,"n").name` returns a table
-- with a name for the current function, if a reasonable name can be found,
-- and the expression `debug.getinfo(print)` returns a table with all available
-- information about the `print` function.
-function debug.getinfo([thread,] function [, what]) end
-
----
--- This function returns the name and the value of the local variable with
--- index `local` of the function at level `level` of the stack. (The first
--- parameter or local variable has index 1, and so on, until the last active
--- local variable.) The function returns nil if there is no local variable
--- with the given index, and raises an error when called with a `level` out
--- of range. (You can call `debug.getinfo` to check whether the level is valid.)
+function debug.getinfo([thread,] f [, what]) end
+
+---
+-- This function returns the name and the value of the local variable with index
+-- `local` of the function at level `f` of the stack. This function accesses not
+-- only explicit local variables, but also parameters, temporaries, etc.
+--
+-- The first parameter or local variable has index 1, and so on, until the last
+-- active variable. Negative indices refer to vararg parameters; -1 is the first
+-- vararg parameter. The function returns nil if there is no variable with the
+-- given index, and raises an error when called with a level out of range. (You
+-- can call `debug.getinfo` to check whether the level is valid.)
+--
-- Variable names starting with '`(`' (open parentheses) represent internal
--- variables (loop control variables, temporaries, and C function locals).
-function debug.getlocal([thread,] level, local) end
+-- variables (loop control variables, temporaries, varargs, and C function
+-- locals).
+--
+-- The parameter `f` may also be a function. In that case, `getlocal` returns
+-- only the name of function parameters.
+function debug.getlocal([thread,] f, local) end
---
--- Returns the metatable of the given `object` or nil if it does not have
+-- Returns the metatable of the given `value` or nil if it does not have
-- a metatable.
-function debug.getmetatable(object) end
+function debug.getmetatable(value) end
---
--- Returns the registry table (see §3.5).
+-- Returns the registry table (see §4.5).
function debug.getregistry() end
---
-- This function returns the name and the value of the upvalue with index
--- `up` of the function `func`. The function returns nil if there is no
--- upvalue with the given index.
-function debug.getupvalue(func, up) end
+-- `up` of the function `f`. The function returns nil if there is no upvalue
+-- with the given index.
+function debug.getupvalue(f, up) end
---
--- Sets the environment of the given `object` to the given `table`. Returns
--- `object`.
-function debug.setfenv(object, table) end
+-- Returns the Lua value associated to `u`. If `u` is not a userdata, returns
+-- nil.
+function debug.getuservalue(u) end
---
-- Sets the given function as a hook. The string `mask` and the number
-- `count` describe when the hook will be called. The string mask may have
-- the following characters, with the given meaning:
--- `"c"`: the hook is called every time Lua calls a function;
--- `"r"`: the hook is called every time Lua returns from a function;
--- `"l"`: the hook is called every time Lua enters a new line of code.
+-- "c": the hook is called every time Lua calls a function;
+-- "r": the hook is called every time Lua returns from a function;
+-- "l": the hook is called every time Lua enters a new line of code.
+--
-- With a `count` different from zero, the hook is called after every `count`
-- instructions.
+--
-- When called without arguments, `debug.sethook` turns off the hook.
+--
-- When the hook is called, its first parameter is a string describing
--- the event that has triggered its call: `"call"`, `"return"` (or `"tail
--- return"`, when simulating a return from a tail call), `"line"`, and
--- `"count"`. For line events, the hook also gets the new line number as its
--- second parameter. Inside a hook, you can call `getinfo` with level 2 to
--- get more information about the running function (level 0 is the `getinfo`
--- function, and level 1 is the hook function), unless the event is `"tail
--- return"`. In this case, Lua is only simulating the return, and a call to
--- `getinfo` will return invalid data.
+-- the event that has triggered its call: `"call"` (or `"tail call"`),
+-- `"return"`, `"line"`, and `"count"`. For line events, the hook also gets the
+-- new line number as its second parameter. Inside a hook, you can call
+-- `getinfo` with level 2 to get more information about the running function
+-- (level 0 is the `getinfo` function, and level 1 is the hook function).
function debug.sethook([thread,] hook, mask [, count]) end
---
@@ -1063,26 +1291,52 @@ function debug.sethook([thread,] hook, mask [, count]) end
-- an error when called with a `level` out of range. (You can call `getinfo`
-- to check whether the level is valid.) Otherwise, it returns the name of
-- the local variable.
+--
+-- See `debug.getlocal` for more information about variable indices and names.
function debug.setlocal([thread,] level, local, value) end
---
--- Sets the metatable for the given `object` to the given `table` (which
+-- Sets the metatable for the given `value` to the given `table` (which
-- can be nil).
-function debug.setmetatable(object, table) end
+function debug.setmetatable(value, table) end
---
-- This function assigns the value `value` to the upvalue with index `up`
--- of the function `func`. The function returns nil if there is no upvalue
--- with the given index. Otherwise, it returns the name of the upvalue.
-function debug.setupvalue(func, up, value) end
+-- of the function `f`. The function returns nil if there is no upvalue with the
+-- given index. Otherwise, it returns the name of the upvalue.
+function debug.setupvalue(f, up, value) end
---
--- Returns a string with a traceback of the call stack. An optional `message`
--- string is appended at the beginning of the traceback. An optional `level`
--- number tells at which level to start the traceback (default is 1, the
--- function calling `traceback`).
+-- Sets the given `value` as the Lua value associated to the given `udata`.
+-- `value` must be a table or nil; `udata` must be a full userdata.
+--
+-- Returns `udata`.
+function debug.setuservalue(udata, value) end
+
+---
+-- If `message` is present but is neither a string nor nil, this function
+-- returns `message` without further processing. Otherwise, it returns a string
+-- with a traceback of the call stack. An optional `message` string is appended
+-- at the beginning of the traceback. An optional `level` number tells at which
+-- level to start the traceback (default is 1, the function calling
+-- `traceback`).
function debug.traceback([thread,] [message] [,level]) end
+---
+-- Returns an unique identifier (as a light userdata) for the upvalue numbered
+-- `n` from the given function.
+--
+-- These unique identifiers allow a program to check whether different closures
+-- share upvalues. Lua closures that share an upvalue (that is, that access a
+-- same external local variable) will return identical ids for those upvalue
+-- indices.
+function debug.upvalueid(f, n) end
+
+---
+-- Make the `n1`-th upvalue of the Lua closure `f1` refer to the `n2`-th upvalue
+-- of the Lua closure `f2`.
+function debug.upvaluejoin(f1, n1, f2, n2) end
+
-- External libraries.
-- LPeg.
@@ -1092,9 +1346,11 @@ function debug.traceback([thread,] [message] [,level]) end
-- subject string. If the match succeeds, returns the index in the subject of
-- the first character after the match, or the captured values (if the pattern
-- captured any value).
+--
-- An optional numeric argument init makes the match starts at that position in
-- the subject string. As usual in Lua libraries, a negative value counts from
-- the end.
+--
-- Unlike typical pattern-matching functions, match works only in anchored mode;
-- that is, it tries to match the pattern with a prefix of the given subject
-- string (at position init), not with an arbitrary substring of the subject.
@@ -1144,6 +1400,7 @@ function lpeg.P(value) end
-- Returns a pattern that matches any single character belonging to one of the
-- given ranges. Each range is a string xy of length 2, representing all
-- characters with code between the codes of x and y (both inclusive).
+--
-- As an example, the pattern lpeg.R("09") matches any digit, and lpeg.R("az",
-- "AZ") matches any ASCII letter.
function lpeg.R({range}) end
@@ -1151,7 +1408,9 @@ function lpeg.R({range}) end
---
-- Returns a pattern that matches any single character that appears in the given
-- string. (The S stands for Set.)
+--
-- As an example, the pattern lpeg.S("+-*/") matches any arithmetic operator.
+--
-- Note that, if s is a character (that is, a string of length 1), then
-- lpeg.P(s) is equivalent to lpeg.S(s) which is equivalent to lpeg.R(s..s).
-- Note also that both lpeg.S("") and lpeg.R() are patterns that always fail.
@@ -1169,6 +1428,7 @@ function lpeg.V(v) end
-- graph, lower, print, punct, space, upper, and xdigit, each one containing a
-- correspondent pattern. Each pattern matches any single character that belongs
-- to its class.
+--
-- If called with an argument table, then it creates those fields inside the
-- given table and returns that table.
function lpeg.locale([table]) end
@@ -1188,6 +1448,7 @@ function lpeg.Carg(n) end
---
-- Creates a back capture. This pattern matches the empty string and produces
-- the values produced by the most recent group capture named name.
+--
-- Most recent means the last complete outermost group capture with the given
-- name. A Complete capture means that the entire pattern corresponding to the
-- capture has matched. An Outermost capture means that the capture is not
@@ -1204,6 +1465,7 @@ function lpeg.Cc([value, ...]) end
-- this capture will produce the value func(...func(func(C1, C2), C3)..., Cn),
-- that is, it will fold (or accumulate, or reduce) the captures from patt using
-- function func.
+--
-- This capture assumes that patt should produce at least one capture with at
-- least one value (of any type), which becomes the initial value of an
-- accumulator. (If you need a specific initial value, you may prefix a constant
@@ -1212,8 +1474,10 @@ function lpeg.Cc([value, ...]) end
-- extra arguments; the value returned by this call becomes the new value for
-- the accumulator. The final value of the accumulator becomes the captured
-- value.
+--
-- As an example, the following pattern matches a list of numbers separated by
-- commas and returns their addition:
+--
-- -- matches a numeral and captures its value
-- number = lpeg.R"09"^1 / tonumber
-- -- matches a list of numbers, captures their values
@@ -1230,6 +1494,7 @@ function lpeg.Cf(patt, func) end
-- Creates a group capture. It groups all values returned by patt into a single
-- capture. The group may be anonymous (if no name is given) or named with the
-- given name.
+--
-- An anonymous group serves to join values from several captures into a single
-- capture. A named group has a different behavior. In most situations, a named
-- group returns no values at all. Its values are only relevant for a following
@@ -1262,8 +1527,10 @@ function lpeg.Ct(patt) end
-- Creates a match-time capture. Unlike all other captures, this one is
-- evaluated immediately when a match occurs. It forces the immediate evaluation
-- of all its nested captures and then calls function.
+--
-- The given function gets as arguments the entire subject, the current position
-- (after the match of patt), plus any capture values produced by patt.
+--
-- The first value returned by function defines how the match happens. If the
-- call returns a number, the match succeeds and the returned number becomes the
-- new current position. (Assuming a subject s and current position i, the
@@ -1271,6 +1538,7 @@ function lpeg.Ct(patt) end
-- true, the match succeeds without consuming any input. (So, to return true is
-- equivalent to return i.) If the call returns false, nil, or no value, the
-- match fails.
+--
-- Any extra values returned by the function become the values produced by the
-- capture.
function lpeg.Cmt(patt, function) end
@@ -1305,6 +1573,7 @@ function lpeg.Cmt(patt, function) end
-- size: file size, in bytes
-- blocks: block allocated for file; (Unix only)
-- blksize: optimal file system I/O blocksize; (Unix only)
+--
-- This function uses stat internally thus if the given filepath is a symbolic
-- link, it is followed (if it points to another link the chain is followed
-- recursively) and the information is about the file it refers to. To obtain
@@ -1313,6 +1582,7 @@ function lfs.attributes(filepath [, aname]) end
---
-- Changes the current working directory to the given path.
+--
-- Returns true in case of success or nil plus an error string.
function lfs.chdir(path) end
@@ -1322,6 +1592,7 @@ function lfs.chdir(path) end
-- second parameter (default for the second parameter is INT_MAX, which in
-- practice means the lock will never be stale. To free the the lock call
-- lock:free().
+--
-- In case of any errors it returns nil and the error message. In particular,
-- if the lock exists and is not stale it returns the "File exists" message.
function lfs.lock_dir(path, [seconds_stale]) end
@@ -1345,18 +1616,21 @@ function lfs.dir(path) end
-- either r (for a read/shared lock) or w (for a write/exclusive lock). The
-- optional arguments start and length can be used to specify a starting point
-- and its length; both should be numbers.
+--
-- Returns true if the operation was successful; in case of error, it returns
-- nil plus an error string.
function lfs.lock(filehandle, mode[, start[, length]])
---
-- Creates a new directory. The argument is the name of the new directory.
+--
-- Returns true if the operation was successful; in case of error, it returns
-- nil plus an error string.
function lfs.mkdir(dirname) end
---
-- Removes an existing directory. The argument is the name of the directory.
+--
-- Returns true if the operation was successful; in case of error, it returns
-- nil plus an error string.
function lfs.rmdir(dirname) end
@@ -1382,6 +1656,7 @@ function lfs.symlinkattributes(filepath [, aname]) end
-- Both times are provided in seconds (which should be generated with Lua
-- standard function os.time). If the modification time is omitted, the access
-- time provided is used; if both times are omitted, the current time is used.
+--
-- Returns true if the operation was successful; in case of error, it returns
-- nil plus an error string.
function lfs.touch(filepath [, atime [, mtime]]) end
@@ -1391,6 +1666,7 @@ function lfs.touch(filepath [, atime [, mtime]]) end
-- handle should be specified as the first argument. The optional arguments
-- start and length can be used to specify a starting point and its length; both
-- should be numbers.
+--
-- Returns true if the operation was successful; in case of error, it returns
-- nil plus an error string.
function lfs.unlock(filehandle[, start[, length]]) end
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua
index 5be70959..b115bc58 100644
--- a/modules/textadept/adeptsense.lua
+++ b/modules/textadept/adeptsense.lua
@@ -1,8 +1,11 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Language autocompletion support for the textadept module.
-module('_m.textadept.adeptsense', package.seeall)
+module('_m.textadept.adeptsense', package.seeall)]]
-- Markdown:
-- ## Overview
@@ -324,8 +327,8 @@ module('_m.textadept.adeptsense', package.seeall)
local senses = {}
-FUNCTIONS = '/* XPM */\nstatic char *function[] = {\n/* columns rows colors chars-per-pixel */\n"16 16 5 1",\n" c #000000",\n". c #E0BC38",\n"X c #F0DC5C",\n"o c #FCFC80",\n"O c None",\n/* pixels */\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOO OOOO",\n"OOOOOOOOO oo OO",\n"OOOOOOOO ooooo O",\n"OOOOOOO ooooo. O",\n"OOOO O XXoo.. O",\n"OOO oo XXX... O",\n"OO ooooo XX.. OO",\n"O ooooo. X. OOO",\n"O XXoo.. O OOOO",\n"O XXX... OOOOOOO",\n"O XXX.. OOOOOOOO",\n"OO X. OOOOOOOOO",\n"OOOO OOOOOOOOOO"\n};'
-FIELDS = '/* XPM */\nstatic char *field[] = {\n/* columns rows colors chars-per-pixel */\n"16 16 5 1",\n" c #000000",\n". c #8C748C",\n"X c #9C94A4",\n"o c #ACB4C0",\n"O c None",\n/* pixels */\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOO OOOOO",\n"OOOOOOOO oo OOO",\n"OOOOOOO ooooo OO",\n"OOOOOO ooooo. OO",\n"OOOOOO XXoo.. OO",\n"OOOOOO XXX... OO",\n"OOOOOO XXX.. OOO",\n"OOOOOOO X. OOOO",\n"OOOOOOOOO OOOOO",\n"OOOOOOOOOOOOOOOO"\n};'
+M.FUNCTIONS = '/* XPM */\nstatic char *function[] = {\n/* columns rows colors chars-per-pixel */\n"16 16 5 1",\n" c #000000",\n". c #E0BC38",\n"X c #F0DC5C",\n"o c #FCFC80",\n"O c None",\n/* pixels */\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOO OOOO",\n"OOOOOOOOO oo OO",\n"OOOOOOOO ooooo O",\n"OOOOOOO ooooo. O",\n"OOOO O XXoo.. O",\n"OOO oo XXX... O",\n"OO ooooo XX.. OO",\n"O ooooo. X. OOO",\n"O XXoo.. O OOOO",\n"O XXX... OOOOOOO",\n"O XXX.. OOOOOOOO",\n"OO X. OOOOOOOOO",\n"OOOO OOOOOOOOOO"\n};'
+M.FIELDS = '/* XPM */\nstatic char *field[] = {\n/* columns rows colors chars-per-pixel */\n"16 16 5 1",\n" c #000000",\n". c #8C748C",\n"X c #9C94A4",\n"o c #ACB4C0",\n"O c None",\n/* pixels */\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOO OOOOO",\n"OOOOOOOO oo OOO",\n"OOOOOOO ooooo OO",\n"OOOOOO ooooo. OO",\n"OOOOOO XXoo.. OO",\n"OOOOOO XXX... OO",\n"OOOOOO XXX.. OOO",\n"OOOOOOO X. OOOO",\n"OOOOOOOOO OOOOO",\n"OOOOOOOOOOOOOOOO"\n};'
---
-- Returns a full symbol (if any) and current symbol part (if any) behind the
@@ -333,7 +336,8 @@ FIELDS = '/* XPM */\nstatic char *field[] = {\n/* columns rows colors chars-per-
-- For example: `buffer.cur` would return `'buffer'` and `'cur'`.
-- @param sense The Adeptsense returned by `adeptsense.new()`.
-- @return symbol or `''`, part or `''`.
-function get_symbol(sense)
+-- @name get_symbol
+function M.get_symbol(sense)
local line, p = buffer:get_cur_line()
local sc, wc = sense.syntax.symbol_chars, sense.syntax.word_chars
local patt = string.format('(%s-)[^%s%%s]+([%s]*)$', sc, wc, wc)
@@ -352,7 +356,8 @@ end
-- @param symbol The symbol to get the class of.
-- @return class or `nil`
-- @see syntax
-function get_class(sense, symbol)
+-- @name get_class
+function M.get_class(sense, symbol)
local buffer = buffer
local self = sense.syntax.self
local class_definition = sense.syntax.class_definition
@@ -446,7 +451,8 @@ end
-- @param only_functions If `true`, returns list of only functions; defaults to
-- `false`.
-- @return completion_list or `nil`
-function get_completions(sense, symbol, only_fields, only_functions)
+-- @name get_completions
+function M.get_completions(sense, symbol, only_fields, only_functions)
if only_fields and only_functions or not symbol then return nil end
local compls = sense.completions
local class = compls[symbol] and symbol or sense:get_class(symbol)
@@ -502,14 +508,15 @@ end
-- @return `true` on success or `false`.
-- @see get_symbol
-- @see get_completions
-function complete(sense, only_fields, only_functions)
+-- @name complete
+function M.complete(sense, only_fields, only_functions)
local buffer = buffer
local symbol, part = sense:get_symbol()
local completions = sense:get_completions(symbol, only_fields, only_functions)
if not completions then return false end
buffer:clear_registered_images()
- buffer:register_image(1, FIELDS)
- buffer:register_image(2, FUNCTIONS)
+ buffer:register_image(1, M.FIELDS)
+ buffer:register_image(2, M.FUNCTIONS)
if not buffer.auto_c_choose_single or #completions ~= 1 then
buffer:auto_c_show(#part, table.concat(completions, ' '))
else
@@ -533,7 +540,8 @@ end
-- @usage sense:add_trigger('.')
-- @usage sense:add_trigger(':', false, true) -- only functions
-- @usage sense:add_trigger('->')
-function add_trigger(sense, c, only_fields, only_functions)
+-- @name add_trigger
+function M.add_trigger(sense, c, only_fields, only_functions)
if #c > 2 then return end -- TODO: warn
local c1, c2 = c:match('.$'):byte(), #c > 1 and c:sub(1, 1):byte()
local i = events.connect(events.CHAR_ADDED, function(char)
@@ -552,7 +560,8 @@ end
-- @param sense The Adeptsense returned by `adeptsense.new()`.
-- @param symbol The symbol to get apidocs for.
-- @return apidoc_list or `nil`
-function get_apidoc(sense, symbol)
+-- @name get_apidoc
+function M.get_apidoc(sense, symbol)
if not symbol then return nil end
local apidocs = { pos = 1 }
local word_chars = sense.syntax.word_chars
@@ -588,7 +597,8 @@ end
-- @return `true` on success or `false`.
-- @see get_symbol
-- @see get_apidoc
-function show_apidoc(sense)
+-- @name show_apidoc
+function M.show_apidoc(sense)
local buffer = buffer
local symbol
local s, e = buffer.selection_start, buffer.selection_end
@@ -637,7 +647,8 @@ end
-- @param tag_file The path of the ctags file to load.
-- @param nolocations If `true`, does not store the locations of the tags for
-- use by `goto_ctag()`. Defaults to `false`.
-function load_ctags(sense, tag_file, nolocations)
+-- @name load_ctags
+function M.load_ctags(sense, tag_file, nolocations)
local ctags_kinds = sense.ctags_kinds
local completions = sense.completions
local locations = sense.locations
@@ -713,7 +724,8 @@ end
-- @param sense The Adeptsense returned by `adeptsense.new()`.
-- @param k The ctag character kind (e.g. `'f'` for a Lua function).
-- @param title The title for the filteredlist dialog.
-function goto_ctag(sense, k, title)
+-- @name goto_ctag
+function M.goto_ctag(sense, k, title)
if not sense.locations[k] then return end -- no ctags loaded
local items = {}
local kind = sense.ctags_kinds[k]
@@ -754,14 +766,16 @@ end
-- @param file_name The name of the file the tag belongs to.
-- @param ex_cmd The `ex_cmd` returned by ctags.
-- @param ext_fields The `ext_fields` returned by ctags.
-function handle_ctag(sense, tag_name, file_name, ex_cmd, ext_fields) end
+-- @name handle_ctag
+function M.handle_ctag(sense, tag_name, file_name, ex_cmd, ext_fields) end
---
-- Clears an Adeptsense.
-- This is necessary for loading a new ctags file or completions from a
-- different project.
-- @param sense The Adeptsense returned by `adeptsense.new()`.
-function clear(sense)
+-- @name clear
+function M.clear(sense)
sense.inherited_classes = {}
sense.completions = {}
sense.locations = {}
@@ -774,7 +788,8 @@ end
-- This function should be replaced with your own if you have any persistant
-- objects that need to be deleted.
-- @param sense The Adeptsense returned by `adeptsense.new()`.
-function handle_clear(sense) end
+-- @name handle_clear
+function M.handle_clear(sense) end
---
-- Creates a new Adeptsense for the given lexer language.
@@ -782,7 +797,8 @@ function handle_clear(sense) end
-- @param lang The lexer language to create an Adeptsense for.
-- @return adeptsense
-- @usage local lua_sense = _m.textadept.adeptsense.new('lua')
-function new(lang)
+-- @name new
+function M.new(lang)
local sense = senses[lang]
if sense then
sense.ctags_kinds = nil
@@ -894,8 +910,8 @@ syntax = {
type_assignments = {}
},
- super = setmetatable({}, { __index = _M })
- }, { __index = _M })
+ super = setmetatable({}, { __index = M })
+ }, { __index = M })
senses[lang] = sense
return sense
@@ -905,7 +921,8 @@ end
-- Completes the symbol at the current position based on the current lexer's
-- Adeptsense.
-- This should be called by key commands and menus instead of `complete()`.
-function complete_symbol()
+-- @name complete_symbol
+function M.complete_symbol()
local m = _m[buffer:get_lexer()]
if m and m.sense then m.sense:complete() end
end
@@ -914,7 +931,10 @@ end
-- Shows API documentation for the symbol at the current position based on the
-- current lexer's Adeptsense.
-- This should be called by key commands and menus instead of `show_apidoc()`.
-function show_documentation()
+-- @name show_documentation
+function M.show_documentation()
local m = _m[buffer:get_lexer()]
if m and m.sense then m.sense:show_apidoc() end
end
+
+return M
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua
index 254b38a1..146dc157 100644
--- a/modules/textadept/bookmarks.lua
+++ b/modules/textadept/bookmarks.lua
@@ -2,9 +2,12 @@
local L = locale.localize
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Bookmarks for the textadept module.
-module('_m.textadept.bookmarks', package.seeall)
+module('_m.textadept.bookmarks', package.seeall)]]
-- Markdown:
-- ## Settings
@@ -13,14 +16,15 @@ module('_m.textadept.bookmarks', package.seeall)
-- `0xBBGGRR` format.
-- settings
-MARK_BOOKMARK_COLOR = 0xB3661A
+M.MARK_BOOKMARK_COLOR = 0xB3661A
-- end settings
local MARK_BOOKMARK = _SCINTILLA.next_marker_number()
---
-- Adds a bookmark to the current line.
-function add()
+-- @name add
+function M.add()
local buffer = buffer
local line = buffer:line_from_position(buffer.current_pos)
buffer:marker_add(line, MARK_BOOKMARK)
@@ -28,7 +32,8 @@ end
---
-- Clears the bookmark at the current line.
-function remove()
+-- @name remove
+function M.remove()
local buffer = buffer
local line = buffer:line_from_position(buffer.current_pos)
buffer:marker_delete(line, MARK_BOOKMARK)
@@ -36,21 +41,26 @@ end
---
-- Toggles a bookmark on the current line.
-function toggle()
+-- @name toggle
+function M.toggle()
local buffer = buffer
local line = buffer:line_from_position(buffer.current_pos)
local markers = buffer:marker_get(line) -- bit mask
local bit = 2^MARK_BOOKMARK
- if markers % (bit + bit) < bit then add() else remove() end
+ if markers % (bit + bit) < bit then M.add() else M.remove() end
end
---
-- Clears all bookmarks in the current buffer.
-function clear() buffer:marker_delete_all(MARK_BOOKMARK) end
+-- @name clear
+function M.clear()
+ buffer:marker_delete_all(MARK_BOOKMARK)
+end
---
-- Goes to the next bookmark in the current buffer.
-function goto_next()
+-- @name goto_next
+function M.goto_next()
local buffer = buffer
local current_line = buffer:line_from_position(buffer.current_pos)
local line = buffer:marker_next(current_line + 1, 2^MARK_BOOKMARK)
@@ -60,7 +70,8 @@ end
---
-- Goes to the previous bookmark in the current buffer.
-function goto_prev()
+-- @name goto_prev
+function M.goto_prev()
local buffer = buffer
local current_line = buffer:line_from_position(buffer.current_pos)
local line = buffer:marker_previous(current_line - 1, 2^MARK_BOOKMARK)
@@ -72,7 +83,8 @@ end
---
-- Goes to selected bookmark from a filtered list.
-function goto_bookmark()
+-- @name goto_bookmark
+function M.goto_bookmark()
local buffer = buffer
local markers, line = {}, buffer:marker_next(0, 2^MARK_BOOKMARK)
if line == -1 then return end
@@ -85,7 +97,9 @@ function goto_bookmark()
if line then _m.textadept.editing.goto_line(line:match('^%d+')) end
end
-if buffer then buffer:marker_set_back(MARK_BOOKMARK, MARK_BOOKMARK_COLOR) end
+if buffer then buffer:marker_set_back(MARK_BOOKMARK, M.MARK_BOOKMARK_COLOR) end
events.connect(events.VIEW_NEW, function()
- buffer:marker_set_back(MARK_BOOKMARK, MARK_BOOKMARK_COLOR)
+ buffer:marker_set_back(MARK_BOOKMARK, M.MARK_BOOKMARK_COLOR)
end)
+
+return M
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua
index 3590c2cb..3eb3c6a5 100644
--- a/modules/textadept/command_entry.lua
+++ b/modules/textadept/command_entry.lua
@@ -4,6 +4,16 @@
local L = locale.localize
local events = events
+--[[ This comment is for LuaDoc.
+---
+-- Textadept's Command entry.
+module('gui.command_entry')]]
+
+-- Markdown:
+-- ## Fields
+--
+-- * `entry_text` [string]: The text in the entry.
+
-- Environment for abbreviated commands.
-- @class table
-- @name env
@@ -81,3 +91,11 @@ events.connect(events.COMMAND_ENTRY_KEYPRESS, function(code)
return true
end
end)
+
+-- The function below is a Lua C function.
+
+---
+-- Focuses the command entry.
+-- @class function
+-- @name focus
+local focus
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index b6e8bf70..c62b7116 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -4,9 +4,12 @@ local L = locale.localize
local events = events
local K = keys.KEYSYMS
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Editing commands for the textadept module.
-module('_m.textadept.editing', package.seeall)
+module('_m.textadept.editing', package.seeall)]]
-- Markdown:
-- ## Settings
@@ -28,13 +31,13 @@ module('_m.textadept.editing', package.seeall)
-- word. The default value is `100`.
-- settings
-AUTOPAIR = true
-HIGHLIGHT_BRACES = true
-AUTOINDENT = true
-STRIP_WHITESPACE_ON_SAVE = true
-MARK_HIGHLIGHT_BACK = buffer and buffer.caret_line_back or 0xEEEEEE
-INDIC_HIGHLIGHT_BACK = 0x4D99E6
-INDIC_HIGHLIGHT_ALPHA = 100
+M.AUTOPAIR = true
+M.HIGHLIGHT_BRACES = true
+M.AUTOINDENT = true
+M.STRIP_WHITESPACE_ON_SAVE = true
+M.MARK_HIGHLIGHT_BACK = buffer and buffer.caret_line_back or 0xEEEEEE
+M.INDIC_HIGHLIGHT_BACK = 0x4D99E6
+M.INDIC_HIGHLIGHT_ALPHA = 100
-- end settings
---
@@ -45,7 +48,7 @@ INDIC_HIGHLIGHT_ALPHA = 100
-- @class table
-- @name comment_string
-- @see block_comment
-comment_string = {}
+M.comment_string = {}
---
-- Auto-matched characters.
@@ -55,7 +58,7 @@ comment_string = {}
-- @class table
-- @name char_matches
-- @usage _m.textadept.editing.char_matches.hypertext = { ..., [60] = '>' }
-char_matches = {
+M.char_matches = {
[40] = ')', [91] = ']', [123] = '}', [39] = "'", [34] = '"'
}
@@ -67,7 +70,7 @@ char_matches = {
-- @class table
-- @name braces
-- @usage _m.textadept.editing.braces.hypertext = { ..., [60] = 1, [62] = 1 }
-braces = { -- () [] {}
+M.braces = { -- () [] {}
[40] = 1, [91] = 1, [123] = 1,
[41] = 1, [93] = 1, [125] = 1,
}
@@ -80,33 +83,33 @@ local current_call_tip = {}
-- Matches characters specified in char_matches.
events.connect(events.CHAR_ADDED, function(c)
- if not AUTOPAIR then return end
+ if not M.AUTOPAIR then return end
local buffer = buffer
- local match = (char_matches[buffer:get_lexer()] or char_matches)[c]
+ local match = (M.char_matches[buffer:get_lexer()] or M.char_matches)[c]
if match and buffer.selections == 1 then buffer:insert_text(-1, match) end
end)
-- Removes matched chars on backspace.
events.connect(events.KEYPRESS, function(code)
- if not AUTOPAIR or K[code] ~= '\b' or buffer.selections ~= 1 then return end
+ if not M.AUTOPAIR or K[code] ~= '\b' or buffer.selections ~= 1 then return end
local buffer = buffer
local pos = buffer.current_pos
local c = buffer.char_at[pos - 1]
- local match = (char_matches[buffer:get_lexer()] or char_matches)[c]
+ local match = (M.char_matches[buffer:get_lexer()] or M.char_matches)[c]
if match and buffer.char_at[pos] == string.byte(match) then buffer:clear() end
end)
-- Highlights matching braces.
events.connect(events.UPDATE_UI, function()
- if not HIGHLIGHT_BRACES then return end
+ if not M.HIGHLIGHT_BRACES then return end
local buffer = buffer
- local current_pos = buffer.current_pos
- if (braces[buffer:get_lexer()] or braces)[buffer.char_at[current_pos]] then
- local pos = buffer:brace_match(current_pos)
- if pos ~= -1 then
- buffer:brace_highlight(current_pos, pos)
+ local pos = buffer.current_pos
+ if (M.braces[buffer:get_lexer()] or M.braces)[buffer.char_at[pos]] then
+ local match = buffer:brace_match(pos)
+ if match ~= -1 then
+ buffer:brace_highlight(pos, match)
else
- buffer:brace_bad_light(current_pos)
+ buffer:brace_bad_light(pos)
end
else
buffer:brace_bad_light(-1)
@@ -115,7 +118,7 @@ end)
-- Auto-indent on return.
events.connect(events.CHAR_ADDED, function(char)
- if not AUTOINDENT or char ~= 10 then return end
+ if not M.AUTOINDENT or char ~= 10 then return end
local buffer = buffer
local anchor, caret = buffer.anchor, buffer.current_pos
local line = buffer:line_from_position(caret)
@@ -157,7 +160,8 @@ end)
---
-- Goes to a matching brace position, selecting the text inside if specified to.
-- @param select If `true`, selects the text between matching braces.
-function match_brace(select)
+-- @name match_brace
+function M.match_brace(select)
local buffer = buffer
local caret = buffer.current_pos
local match_pos = buffer:brace_match(caret)
@@ -175,7 +179,8 @@ end
-- the document.
-- @param word_chars String of chars considered to be part of words.
-- @return `true` if there were completions to show; `false` otherwise.
-function autocomplete_word(word_chars)
+-- @name autocomplete_word
+function M.autocomplete_word(word_chars)
local buffer = buffer
local caret, length = buffer.current_pos, buffer.length
local completions, c_list = {}, {}
@@ -220,10 +225,11 @@ end
-- Block comments or uncomments code with a given comment string.
-- @param comment The comment string inserted or removed from the beginning of
-- each line in the selection.
-function block_comment(comment)
+-- @name block_comment
+function M.block_comment(comment)
local buffer = buffer
if not comment then
- comment = comment_string[buffer:get_lexer()]
+ comment = M.comment_string[buffer:get_lexer()]
if not comment then return end
end
local anchor, caret = buffer.selection_start, buffer.selection_end
@@ -251,7 +257,8 @@ end
-- Goes to the requested line.
-- @param line Optional line number to go to. If `nil`, the user is prompted for
-- one.
-function goto_line(line)
+-- @name goto_line
+function M.goto_line(line)
if not line then
line = tonumber(gui.dialog('standard-inputbox',
'--title', L('Go To'),
@@ -267,8 +274,9 @@ end
-- Prepares the buffer for saving to a file.
-- Strips trailing whitespace off of every line, ensures an ending newline, and
-- converts non-consistent EOLs.
-function prepare_for_save()
- if not STRIP_WHITESPACE_ON_SAVE then return end
+-- @name prepare_for_save
+function M.prepare_for_save()
+ if not M.STRIP_WHITESPACE_ON_SAVE then return end
local buffer = buffer
buffer:begin_undo_action()
-- Strip trailing whitespace.
@@ -297,13 +305,14 @@ function prepare_for_save()
buffer:convert_eo_ls(buffer.eol_mode)
buffer:end_undo_action()
end
-events.connect(events.FILE_BEFORE_SAVE, prepare_for_save)
+events.connect(events.FILE_BEFORE_SAVE, M.prepare_for_save)
---
-- Selects the current word under the caret and if action indicates, deletes it.
-- @param action Optional action to perform with selected word. If `delete`, it
-- is deleted.
-function current_word(action)
+-- @name current_word
+function M.current_word(action)
local buffer = buffer
buffer:set_sel(buffer:word_start_position(buffer.current_pos),
buffer:word_end_position(buffer.current_pos))
@@ -314,7 +323,8 @@ end
-- Transposes characters intelligently.
-- If the caret is at the end of a line, the two characters before the caret are
-- transposed. Otherwise, the characters to the left and right are.
-function transpose_chars()
+-- @name transpose_chars
+function M.transpose_chars()
local buffer = buffer
local pos = buffer.current_pos
if pos == buffer.length then return end
@@ -328,7 +338,8 @@ end
---
-- Joins the current line with the line below.
-function join_lines()
+-- @name join_lines
+function M.join_lines()
local buffer = buffer
buffer:line_end()
local line = buffer:line_from_position(buffer.current_pos)
@@ -343,7 +354,8 @@ end
-- enclosed.
-- @param left The left part of the enclosure.
-- @param right The right part of the enclosure.
-function enclose(left, right)
+-- @name enclose
+function M.enclose(left, right)
local buffer = buffer
buffer:begin_undo_action()
local txt = buffer:get_sel_text()
@@ -359,7 +371,8 @@ end
-- Selects text between a given pair of strings.
-- @param left The left part of the enclosure.
-- @param right The right part of the enclosure.
-function select_enclosed(left, right)
+-- @name select_enclosed
+function M.select_enclosed(left, right)
local buffer = buffer
buffer:search_anchor()
local s = buffer:search_prev(0, left)
@@ -370,7 +383,8 @@ end
---
-- Grows the selection by a character amount on either end.
-- @param amount The amount to grow the selection on either end.
-function grow_selection(amount)
+-- @name grow_selection
+function M.grow_selection(amount)
local buffer = buffer
local anchor, caret = buffer.anchor, buffer.current_pos
if anchor < caret then
@@ -382,7 +396,8 @@ end
---
-- Selects the current line.
-function select_line()
+-- @name select_line
+function M.select_line()
buffer:home()
buffer:line_end_extend()
end
@@ -390,7 +405,8 @@ end
---
-- Selects the current paragraph.
-- Paragraphs are delimited by two or more consecutive newlines.
-function select_paragraph()
+-- @name select_paragraph
+function M.select_paragraph()
buffer:para_up()
buffer:para_down_extend()
end
@@ -402,7 +418,8 @@ end
-- top and bottom of it are one indentation level lower, they are added to the
-- selection. In all other cases, the behavior is the same as if no text is
-- selected.
-function select_indented_block()
+-- @name select_indented_block
+function M.select_indented_block()
local buffer = buffer
local s = buffer:line_from_position(buffer.selection_start)
local e = buffer:line_from_position(buffer.selection_end)
@@ -423,7 +440,8 @@ end
---
-- Converts indentation between tabs and spaces.
-function convert_indentation()
+-- @name convert_indentation
+function M.convert_indentation()
local buffer = buffer
local line_indentation = buffer.line_indentation
local line_indent_position = buffer.line_indent_position
@@ -463,7 +481,8 @@ end)
---
-- Highlights all occurances of the word under the caret and adds markers to the
-- lines they are on.
-function highlight_word()
+-- @name highlight_word
+function M.highlight_word()
clear_highlighted_words()
local buffer = buffer
local s, e = buffer.selection_start, buffer.selection_end
@@ -490,10 +509,12 @@ end
-- Sets view properties for highlighted word indicators and markers.
local function set_highlight_properties()
local buffer = buffer
- buffer:marker_set_back(MARK_HIGHLIGHT, MARK_HIGHLIGHT_BACK)
- buffer.indic_fore[INDIC_HIGHLIGHT] = INDIC_HIGHLIGHT_BACK
+ buffer:marker_set_back(MARK_HIGHLIGHT, M.MARK_HIGHLIGHT_BACK)
+ buffer.indic_fore[INDIC_HIGHLIGHT] = M.INDIC_HIGHLIGHT_BACK
buffer.indic_style[INDIC_HIGHLIGHT] = _SCINTILLA.constants.INDIC_ROUNDBOX
- buffer.indic_alpha[INDIC_HIGHLIGHT] = INDIC_HIGHLIGHT_ALPHA
+ buffer.indic_alpha[INDIC_HIGHLIGHT] = M.INDIC_HIGHLIGHT_ALPHA
end
if buffer then set_highlight_properties() end
events.connect(events.VIEW_NEW, set_highlight_properties)
+
+return M
diff --git a/modules/textadept/filter_through.lua b/modules/textadept/filter_through.lua
index bb55f444..98c21945 100644
--- a/modules/textadept/filter_through.lua
+++ b/modules/textadept/filter_through.lua
@@ -3,9 +3,12 @@
local L = locale.localize
local events = events
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Filter-Through for the textadept module.
-module('_m.textadept.filter_through', package.seeall)
+module('_m.textadept.filter_through', package.seeall)]]
local cat = not WIN32 and 'cat' or 'type'
local tmpfile = _USERHOME..'/.ft'
@@ -22,7 +25,8 @@ local filter_through_active = false
-- text is selected and spans a single line, only the selected text is used. (3)
-- If no text is selected, the entire buffer is used.
-- The input text is replaced with the standard output (stdout) of the command.
-function filter_through()
+-- @name filter_through
+function M.filter_through()
filter_through_active = true
gui.command_entry.focus()
end
@@ -69,3 +73,5 @@ events.connect(events.COMMAND_ENTRY_COMMAND, function(text)
return true
end
end, 1) -- place before command_entry.lua's handler (if necessary)
+
+return M
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index be54e3ae..c9146e7a 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -5,6 +5,41 @@ local events = events
local find = gui.find
local c = _SCINTILLA.constants
+--[[ This comment is for LuaDoc.
+---
+-- Textadept's integrated find/replace dialog.
+module('gui.find')]]
+
+-- Markdown:
+-- ## Fields
+--
+-- * `find_entry_text` [string]: The text in the find entry.
+-- * `replace_entry_text` [string]: The text in the replace entry.
+-- * `match_case` [bool]: Searches are case-sensitive.
+-- * `whole_word` [bool]: Only whole-word matches are allowed in searches.
+-- * `lua` [bool]: The search text is interpreted as a Lua pattern.
+-- * `in_files` [bool]: Search for the text in a list of files.
+-- * `find_label_text` [string]: The text of the 'Find' label. This is primarily
+-- used for localization. (Write-only)
+-- * `replace_label_text` [string]: The text of the 'Replace' label. This is
+-- primarily used for localization. (Write-only)
+-- * `find_next_button_text` [string]: The text of the 'Find Next' button. This
+-- is primarily used for localization. (Write-only)
+-- * `find_prev_button_text` [string]: The text of the 'Find Prev' button. This
+-- is primarily used for localization. (Write-only)
+-- * `replace_button_text` [string]: The text of the 'Replace' button. This is
+-- primarily used for localization. (Write-only)
+-- * `replace_all_button_text` [string]: The text of the 'Replace All' button.
+-- This is primarily used for localization. (Write-only)
+-- * `match_case_label_text` [string]: The text of the 'Match case' label. This
+-- is primarily used for localization. (Write-only)
+-- * `whole_word_label_text` [string]: The text of the 'Whole word' label. This
+-- is primarily used for localization. (Write-only)
+-- * `lua_pattern_label_text` [string]: The text of the 'Lua pattern' label.
+-- This is primarily used for localization. (Write-only)
+-- * `in_files_label_text` [string]: The text of the 'In files' label. This is
+-- primarily used for localization. (Write-only)
+
find.find_label_text = L('Find:')
find.replace_label_text = L('Replace:')
find.find_next_button_text = L('Find Next')
@@ -28,7 +63,12 @@ local escapes = {
['\\r'] = '\r', ['\\t'] = '\t', ['\\v'] = '\v', ['\\\\'] = '\\'
}
--- LuaDoc is in core/.find.luadoc.
+---
+-- Performs a find in files with the given directory.
+-- Use the `gui.find` fields to set the text to find and option flags.
+-- @param utf8_dir UTF-8 encoded directory name. If none is provided, the user
+-- is prompted for one.
+-- @name find_in_files
function find.find_in_files(utf8_dir)
if not utf8_dir then
utf8_dir = gui.dialog('fileselect',
@@ -166,7 +206,11 @@ local function find_incremental(text)
find_(text, true, flags)
end
--- LuaDoc is in core/.find.luadoc.
+---
+-- Begins an incremental find using the Lua command entry.
+-- Lua command functionality will be unavailable until the search is finished
+-- (pressing 'Escape' by default).
+-- @name find_incremental
function find.find_incremental()
find.incremental = true
find.incremental_start = buffer.current_pos
@@ -316,7 +360,11 @@ local function goto_file(pos, line_num)
end
events.connect(events.DOUBLE_CLICK, goto_file)
--- LuaDoc is in core/.find.luadoc.
+---
+-- Goes to the next or previous file found relative to the file
+-- on the current line.
+-- @param next Flag indicating whether or not to go to the next file.
+-- @name goto_file_in_list
function find.goto_file_in_list(next)
local orig_view = _VIEWS[view]
for _, buffer in ipairs(_BUFFERS) do
@@ -348,3 +396,35 @@ if buffer then buffer:marker_set_back(MARK_FIND, MARK_FIND_COLOR) end
events.connect(events.VIEW_NEW, function()
buffer:marker_set_back(MARK_FIND, MARK_FIND_COLOR)
end)
+
+-- The functions below are Lua C functions.
+
+---
+-- Displays and focuses the find/replace dialog.
+-- @class function
+-- @name focus
+local focus
+
+---
+-- Mimicks a press of the 'Find Next' button in the Find box.
+-- @class function
+-- @name find_next
+local find_next
+
+---
+-- Mimicks a press of the 'Find Prev' button in the Find box.
+-- @class function
+-- @name find_prev
+local find_prev
+
+---
+-- Mimicks a press of the 'Replace' button in the Find box.
+-- @class function
+-- @name replace
+local replace
+
+---
+-- Mimicks a press of the 'Replace All' button in the Find box.
+-- @class function
+-- @name replace_all
+local replace_all
diff --git a/modules/textadept/init.lua b/modules/textadept/init.lua
index 12b085c4..c5dc1ea9 100644
--- a/modules/textadept/init.lua
+++ b/modules/textadept/init.lua
@@ -1,22 +1,28 @@
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local M = {}
+_m.textadept = M
+
+--[[ This comment is for LuaDoc.
---
-- The textadept module.
-- It provides utilities for editing text in Textadept.
-module('_m.textadept', package.seeall)
+module('_m.textadept', package.seeall)]]
-require 'textadept.adeptsense'
-require 'textadept.bookmarks'
+M.adeptsense = require 'textadept.adeptsense'
+M.bookmarks = require 'textadept.bookmarks'
require 'textadept.command_entry'
-require 'textadept.editing'
+M.editing = require 'textadept.editing'
require 'textadept.find'
-require 'textadept.filter_through'
-require 'textadept.mime_types'
-require 'textadept.run'
-require 'textadept.session'
-require 'textadept.snapopen'
-require 'textadept.snippets'
+M.filter_through = require 'textadept.filter_through'
+M.mime_types = require 'textadept.mime_types'
+M.run = require 'textadept.run'
+M.session = require 'textadept.session'
+M.snapopen = require 'textadept.snapopen'
+M.snippets = require 'textadept.snippets'
-- These need to be loaded last.
-require 'textadept.keys'
-require 'textadept.menu'
+M.keys = require 'textadept.keys'
+M.menu = require 'textadept.menu'
+
+return M
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index 275a5616..ec9133f3 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -3,18 +3,21 @@
local L = locale.localize
local gui = gui
+local M = {}
+
+--[[
---
-- Defines key commands for Textadept.
-- This set of key commands is pretty standard among other text editors.
-- This module, should be 'require'ed last, but before _m.textadept.menu.
-module('_m.textadept.keys', package.seeall)
+module('_m.textadept.keys', package.seeall)]]
local keys, _buffer, _view = keys, buffer, view
local m_textadept, m_editing = _m.textadept, _m.textadept.editing
local c, OSX = _SCINTILLA.constants, OSX
-- Utility functions.
-utils = {
+M.utils = {
enclose_as_xml_tags = function()
m_editing.enclose('<', '>')
local buffer = buffer
@@ -78,7 +81,8 @@ utils = {
if not p then error(L('Error loading webpage:')..url) end
else
cmd = string.format(OSX and 'open "file://%s"' or 'xdg-open "%s" &', url)
- if os.execute(cmd) ~= 0 then error(L('Error loading webpage:')..url) end
+ local _, _, code = os.execute(cmd)
+ if code ~= 0 then error(L('Error loading webpage:')..url) end
end
end
}
@@ -175,7 +179,7 @@ keys[not OSX and 'cI' or 'mI'] = m_editing.select_indented_block
-- Selection.
keys[not OSX and 'cau' or 'cu'] = _buffer.upper_case
keys[not OSX and 'caU' or 'cU'] = _buffer.lower_case
-keys[not OSX and 'a<' or 'c<'] = utils.enclose_as_xml_tags
+keys[not OSX and 'a<' or 'c<'] = M.utils.enclose_as_xml_tags
keys[not OSX and 'a>' or 'c>'] = { m_editing.enclose, '<', ' />' }
keys[not OSX and "a'" or "c'"] = { m_editing.enclose, "'", "'" }
keys[not OSX and 'a"' or 'c"'] = { m_editing.enclose, '"', '"' }
@@ -200,7 +204,7 @@ keys[not OSX and 'caR' or 'cR'] = gui.find.replace_all
-- Replace is ar when find pane is focused.
-- Replace All is aa when find pane is focused.
keys[not OSX and 'caf' or 'cmf'] = gui.find.find_incremental
-keys[not OSX and 'cF' or 'mF'] = utils.find_in_files
+keys[not OSX and 'cF' or 'mF'] = M.utils.find_in_files
-- Find in Files is ai when find pane is focused.
keys[not OSX and 'cag' or 'cmg'] = { gui.find.goto_file_in_list, true }
keys[not OSX and 'caG' or 'cmG'] = { gui.find.goto_file_in_list, false }
@@ -208,7 +212,7 @@ keys[not OSX and 'cj' or 'mj'] = m_editing.goto_line
-- Tools.
keys[not OSX and 'ce' or 'me'] = gui.command_entry.focus
-keys[not OSX and 'cE' or 'mE'] = utils.select_command
+keys[not OSX and 'cE' or 'mE'] = M.utils.select_command
keys[not OSX and 'cr' or 'mr'] = m_textadept.run.run
keys[not OSX and 'cR' or 'mR'] = m_textadept.run.compile
keys[not OSX and 'c|' or 'm|'] = m_textadept.filter_through.filter_through
@@ -229,30 +233,30 @@ keys.af2 = m_textadept.bookmarks.goto_bookmark
-- Snapopen.
keys[not OSX and 'cu' or 'mu'] = { m_textadept.snapopen.open, _USERHOME }
-- TODO: { m_textadept.snapopen.open, _HOME }
-keys[not OSX and 'caO' or 'cmO'] = utils.snapopen_filedir
-keys[not OSX and 'ci' or 'mi'] = utils.show_style
+keys[not OSX and 'caO' or 'cmO'] = M.utils.snapopen_filedir
+keys[not OSX and 'ci' or 'mi'] = M.utils.show_style
-- Buffer.
keys['c\t'] = { _view.goto_buffer, _view, 1, true }
keys['cs\t'] = { _view.goto_buffer, _view, -1, true }
keys[not OSX and 'cb' or 'mb'] = gui.switch_buffer
-- Indentation.
--- TODO: { utils.set_indentation, 2 }
--- TODO: { utils.set_indentation, 3 }
--- TODO: { utils.set_indentation, 4 }
--- TODO: { utils.set_indentation, 8 }
-keys[not OSX and 'caT' or 'cT'] = { utils.toggle_property, 'use_tabs' }
+-- TODO: { M.utils.set_indentation, 2 }
+-- TODO: { M.utils.set_indentation, 3 }
+-- TODO: { M.utils.set_indentation, 4 }
+-- TODO: { M.utils.set_indentation, 8 }
+keys[not OSX and 'caT' or 'cT'] = { M.utils.toggle_property, 'use_tabs' }
keys[not OSX and 'cai' or 'ci'] = m_editing.convert_indentation
-- EOL Mode.
--- TODO: { utils.set_eol_mode, c.SC_EOL_CRLF }
--- TODO: { utils.set_eol_mode, c.SC_EOL_CR }
--- TODO: { utils.set_eol_mode, c.SC_EOL_LF }
+-- TODO: { M.utils.set_eol_mode, c.SC_EOL_CRLF }
+-- TODO: { M.utils.set_eol_mode, c.SC_EOL_CR }
+-- TODO: { M.utils.set_eol_mode, c.SC_EOL_LF }
-- Encoding.
--- TODO: { utils.set_encoding, 'UTF-8' }
--- TODO: { utils.set_encoding, 'ASCII' }
--- TODO: { utils.set_encoding, 'ISO-8859-1' }
--- TODO: { utils.set_encoding, 'MacRoman' }
--- TODO: { utils.set_encoding, 'UTF-16LE' }
+-- TODO: { M.utils.set_encoding, 'UTF-8' }
+-- TODO: { M.utils.set_encoding, 'ASCII' }
+-- TODO: { M.utils.set_encoding, 'ISO-8859-1' }
+-- TODO: { M.utils.set_encoding, 'MacRoman' }
+-- TODO: { M.utils.set_encoding, 'UTF-16LE' }
keys[not OSX and 'cL' or 'mL'] = m_textadept.mime_types.select_lexer
keys.f5 = { _buffer.colourise, _buffer, 0, -1 }
@@ -263,27 +267,27 @@ keys[not OSX and 'cas' or 'cs'] = { _view.split, _view }
if not OSX then keys.cah = keys.cas end
keys[not OSX and 'cav' or 'cv'] = { _view.split, _view, true }
keys[not OSX and 'caw' or 'cw'] = { _view.unsplit, _view }
-keys[not OSX and 'caW' or 'cW'] = utils.unsplit_all
-keys[not OSX and 'ca+' or 'c+'] = { utils.grow, 10 }
-keys[not OSX and 'ca=' or 'c='] = { utils.grow, 10 }
-keys[not OSX and 'ca-' or 'c-'] = { utils.shrink, 10 }
--- TODO: utils.toggle_current_fold
-keys[not OSX and 'ca\n' or 'c\n'] = { utils.toggle_property, 'view_eol' }
+keys[not OSX and 'caW' or 'cW'] = M.utils.unsplit_all
+keys[not OSX and 'ca+' or 'c+'] = { M.utils.grow, 10 }
+keys[not OSX and 'ca=' or 'c='] = { M.utils.grow, 10 }
+keys[not OSX and 'ca-' or 'c-'] = { M.utils.shrink, 10 }
+-- TODO: M.utils.toggle_current_fold
+keys[not OSX and 'ca\n' or 'c\n'] = { M.utils.toggle_property, 'view_eol' }
if not OSX then keys['ca\n\r'] = keys['ca\n'] end
-keys[not OSX and 'ca\\' or 'c\\'] = { utils.toggle_property, 'wrap_mode' }
+keys[not OSX and 'ca\\' or 'c\\'] = { M.utils.toggle_property, 'wrap_mode' }
keys[not OSX and 'caI' or 'cI'] =
- { utils.toggle_property, 'indentation_guides' }
-keys[not OSX and 'caS' or 'cS'] = { utils.toggle_property, 'view_ws' }
+ { M.utils.toggle_property, 'indentation_guides' }
+keys[not OSX and 'caS' or 'cS'] = { M.utils.toggle_property, 'view_ws' }
keys[not OSX and 'caV' or 'cV'] =
- { utils.toggle_property, 'virtual_space_options', c.SCVS_USERACCESSIBLE }
+ { M.utils.toggle_property, 'virtual_space_options', c.SCVS_USERACCESSIBLE }
keys[not OSX and 'c=' or 'm='] = _buffer.zoom_in
keys[not OSX and 'c-' or 'm-'] = _buffer.zoom_out
-keys[not OSX and 'c0' or 'm0'] = utils.reset_zoom
+keys[not OSX and 'c0' or 'm0'] = M.utils.reset_zoom
keys[not OSX and 'cT' or 'mT'] = gui.select_theme
-- Help.
-keys.f1 = { utils.open_webpage, _HOME..'/doc/manual/1_Introduction.html' }
-keys.sf1 = { utils.open_webpage, _HOME..'/doc/index.html' }
+keys.f1 = { M.utils.open_webpage, _HOME..'/doc/manual/1_Introduction.html' }
+keys.sf1 = { M.utils.open_webpage, _HOME..'/doc/index.html' }
-- TODO: { gui.dialog, 'ok-msgbox', '--title', 'Textadept'
-- '--informative-text', _RELEASE, '--no-cancel' }
@@ -312,3 +316,5 @@ if OSX then
keys.cd = _buffer.clear
keys.cl = _buffer.vertical_centre_caret
end
+
+return M
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index 0ba21390..653437cf 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -4,11 +4,14 @@
local L = locale.localize
local gui = gui
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Provides dynamic menus for Textadept.
-- This module should be `require`ed last, after `_m.textadept.keys` since it
-- looks up defined key commands to show them in menus.
-module('_m.textadept.menu', package.seeall)
+module('_m.textadept.menu', package.seeall)]]
local _buffer, _view = buffer, view
local m_textadept, m_editing = _m.textadept, _m.textadept.editing
@@ -32,7 +35,7 @@ end
-- Contains the main menubar.
-- @class table
-- @name menubar
-menubar = {
+M.menubar = {
{ title = L('File'),
{ L('gtk-new'), new_buffer },
{ L('gtk-open'), io.open_file },
@@ -220,7 +223,7 @@ menubar = {
-- Contains the default right-click context menu.
-- @class table
-- @name context_menu
-context_menu = {
+M.context_menu = {
{ L('gtk-undo'), _buffer.undo },
{ L('gtk-redo'), _buffer.redo },
SEPARATOR,
@@ -275,7 +278,8 @@ end
-- for setting a menu accelerator. If the menu text is `'separator'`, a menu
-- separator is created and no action table is required.
-- @see keys.get_gdk_key
-function set_menubar(menubar)
+-- @name set_menubar
+function M.set_menubar(menubar)
key_shortcuts = {}
for key, f in pairs(keys) do key_shortcuts[get_id(f)] = key end
menu_actions = {}
@@ -285,18 +289,19 @@ function set_menubar(menubar)
end
gui.menubar = _menubar
end
-set_menubar(menubar)
+M.set_menubar(M.menubar)
---
-- Sets `gui.context_menu` from the given menu table.
-- @param menu_table The menu table to create the context menu from. Each table
-- entry is either a submenu or menu text and a function or action table.
-- @see set_menubar
-function set_contextmenu(menu_table)
+-- @name set_contextmenu
+function M.set_contextmenu(menu_table)
contextmenu_actions = {}
gui.context_menu = gui.gtkmenu(read_menu_table(menu_table, true))
end
-set_contextmenu(context_menu)
+M.set_contextmenu(M.context_menu)
local items, commands
@@ -322,7 +327,8 @@ end
local columns = { L('Command'), L('Key Command') }
---
-- Prompts the user with a filteredlist to run menu commands.
-function select_command()
+-- @name select_command
+function M.select_command()
local i = gui.filteredlist(L('Run Command'), columns, items, true)
if i then keys.run_command(commands[i + 1], type(commands[i + 1])) end
end
@@ -330,11 +336,12 @@ end
---
-- Rebuilds the tables used by `select_command()`.
-- This should be called every time `set_menubar()` is called.
-function rebuild_command_tables()
+-- @name rebuild_command_tables
+function M.rebuild_command_tables()
items, commands = {}, {}
- build_command_tables(menubar, nil, items, commands)
+ build_command_tables(M.menubar, nil, items, commands)
end
-rebuild_command_tables()
+M.rebuild_command_tables()
events.connect(events.MENU_CLICKED, function(menu_id)
local actions = menu_id < 1000 and menu_actions or contextmenu_actions
@@ -348,9 +355,11 @@ end)
-- Set a language-specific context menu or the default one.
local function set_language_contextmenu()
local lang = buffer:get_lexer()
- set_contextmenu(_m[lang] and _m[lang].context_menu or context_menu)
+ M.set_contextmenu(_m[lang] and _m[lang].context_menu or M.context_menu)
end
events.connect(events.LANGUAGE_MODULE_LOADED, set_language_contextmenu)
events.connect(events.BUFFER_AFTER_SWITCH, set_language_contextmenu)
events.connect(events.VIEW_AFTER_SWITCH, set_language_contextmenu)
events.connect(events.BUFFER_NEW, set_lang_contextmenu)
+
+return M
diff --git a/modules/textadept/mime_types.lua b/modules/textadept/mime_types.lua
index 51b60636..8a11be5d 100644
--- a/modules/textadept/mime_types.lua
+++ b/modules/textadept/mime_types.lua
@@ -3,9 +3,12 @@
local L = locale.localize
local events = events
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Handles file-specific settings.
-module('_m.textadept.mime_types', package.seeall)
+module('_m.textadept.mime_types', package.seeall)]]
-- Markdown:
-- ## Overview
@@ -36,19 +39,19 @@ events.LANGUAGE_MODULE_LOADED = 'language_module_loaded'
-- File extensions with their associated lexers.
-- @class table
-- @name extensions
-extensions = {}
+M.extensions = {}
---
-- Shebang words and their associated lexers.
-- @class table
-- @name shebangs
-shebangs = {}
+M.shebangs = {}
---
-- First-line patterns and their associated lexers.
-- @class table
-- @name patterns
-patterns = {}
+M.patterns = {}
-- Load mime-types from `modules/textadept/mime_types.conf`.
local mime_types
@@ -66,11 +69,11 @@ for line in mime_types:gmatch('[^\r\n]+') do
if not line:find('^%s*%%') then
if line:find('^%s*[^#/]') then -- extension definition
local ext, lexer_name = line:match('^%s*(.+)%s+(%S+)$')
- if ext and lexer_name then extensions[ext] = lexer_name end
+ if ext and lexer_name then M.extensions[ext] = lexer_name end
else -- shebang or pattern
local ch, text, lexer_name = line:match('^%s*([#/])(.+)%s+(%S+)$')
if ch and text and lexer_name then
- (ch == '#' and shebangs or patterns)[text] = lexer_name
+ (ch == '#' and M.shebangs or M.patterns)[text] = lexer_name
end
end
end
@@ -81,7 +84,7 @@ end
-- Lexers are read from `lexers/` and `~/.textadept/lexers/`.
-- @class table
-- @name lexers
-lexers = {}
+M.lexers = {}
-- Generate lexer list
local lexers_found = {}
@@ -97,14 +100,15 @@ if lfs.attributes(_USERHOME..'/lexers') then
end
end
end
-for lexer in pairs(lexers_found) do lexers[#lexers + 1] = lexer end
-table.sort(lexers)
+for lexer in pairs(lexers_found) do M.lexers[#M.lexers + 1] = lexer end
+table.sort(M.lexers)
---
-- Prompts the user to select a lexer from a filtered list for the current
-- buffer.
-function select_lexer()
- local lexer = gui.filteredlist(L('Select Lexer'), 'Name', lexers)
+-- @name select_lexer
+function M.select_lexer()
+ local lexer = gui.filteredlist(L('Select Lexer'), 'Name', M.lexers)
if lexer then buffer:set_lexer(lexer) end
end
@@ -129,14 +133,13 @@ local function set_lexer(buffer, lang)
buffer._lexer = lang
buffer:private_lexer_call(SETDIRECTPOINTER, buffer.direct_pointer)
buffer:private_lexer_call(SETLEXERLANGUAGE, lang)
- local ok, err = pcall(require, lang)
- if ok then
- ok, err = pcall(require, lang..'.post_init')
+ if package.searchpath(lang, package.path) then
+ _m[lang] = require(lang)
+ local post_init = lang..'.post_init'
+ if package.searchpath(post_init, package.path) then require(post_init) end
_m[lang].set_buffer_properties()
events.emit(events.LANGUAGE_MODULE_LOADED, lang)
end
- local module_not_found = "^module '"..lang.."[^\']*' not found:"
- if not ok and not err:find(module_not_found) then error(err) end
buffer:colourise(0, -1)
-- Create the ws_styles[lexer] lookup table for `get_lexer()`.
if ws_styles[lang] then return end
@@ -175,17 +178,17 @@ local function handle_new()
local line = buffer:get_line(0)
if line:find('^#!') then
for word in line:gsub('[/\\]', ' '):gmatch('%S+') do
- lexer = shebangs[word]
+ lexer = M.shebangs[word]
if lexer then break end
end
end
if not lexer then
- for patt, lex in pairs(patterns) do
+ for patt, lex in pairs(M.patterns) do
if line:find(patt) then lexer = lex break end
end
end
if not lexer and buffer.filename then
- lexer = extensions[buffer.filename:match('[^/\\.]+$')]
+ lexer = M.extensions[buffer.filename:match('[^/\\.]+$')]
end
buffer:set_lexer(lexer or 'container')
end
@@ -203,3 +206,5 @@ events.connect(events.VIEW_NEW, restore_lexer, 1)
events.connect(events.RESET_AFTER,
function() buffer:set_lexer(buffer._lexer or 'container') end)
+
+return M
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 8e1561f3..7267b486 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -3,12 +3,15 @@
local L = locale.localize
local events = events
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Module for running/executing source files.
-- Typically, language-specific modules populate the 'compile_command',
-- 'run_command', and 'error_detail' tables for a particular language's file
-- extension.
-module('_m.textadept.run', package.seeall)
+module('_m.textadept.run', package.seeall)]]
-- Markdown:
-- ## Run Events
@@ -40,7 +43,8 @@ events.RUN_OUTPUT = 'run_output'
-- + `%(filedir)`: The current file's directory path.
-- + `%(filename)`: The name of the file including extension.
-- + `%(filename_noext)`: The name of the file excluding extension.
-function execute(command)
+-- @name execute
+function M.execute(command)
local filepath = buffer.filename:iconv(_CHARSET, 'UTF-8')
local filedir, filename = '', filepath
if filepath:find('[/\\]') then
@@ -69,7 +73,7 @@ local function command(cmd_table)
buffer:save()
local action = cmd_table[buffer.filename:match('[^.]+$')]
if not action then return end
- return execute(type(action) == 'function' and action() or action)
+ return M.execute(type(action) == 'function' and action() or action)
end
---
@@ -79,15 +83,16 @@ end
-- This table is typically populated by language-specific modules.
-- @class table
-- @name compile_command
-compile_command = {}
+M.compile_command = {}
---
-- Compiles the file as specified by its extension in the `compile_command`
-- table.
-- @see compile_command
-function compile()
+-- @name compile
+function M.compile()
events.emit(events.COMPILE_OUTPUT, buffer:get_lexer(),
- command(compile_command))
+ command(M.compile_command))
end
events.connect(events.COMPILE_OUTPUT,
function(lexer, output) gui.print(output) end)
@@ -99,14 +104,15 @@ events.connect(events.COMPILE_OUTPUT,
-- This table is typically populated by language-specific modules.
-- @class table
-- @name run_command
-run_command = {}
+M.run_command = {}
---
-- Runs/executes the file as specified by its extension in the `run_command`
-- table.
-- @see run_command
-function run()
- events.emit(events.RUN_OUTPUT, buffer:get_lexer(), command(run_command))
+-- @name run
+function M.run()
+ events.emit(events.RUN_OUTPUT, buffer:get_lexer(), command(M.run_command))
end
events.connect(events.RUN_OUTPUT,
function(lexer, output) gui.print(output) end)
@@ -126,7 +132,7 @@ events.connect(events.RUN_OUTPUT,
-- This table is usually populated by language-specific modules.
-- @class table
-- @name error_detail
-error_detail = {}
+M.error_detail = {}
---
-- When the user double-clicks an error message, go to the line in the file
@@ -141,7 +147,7 @@ function goto_error(pos, line_num)
end
local buffer = buffer
line = buffer:get_line(line_num)
- for _, error_detail in pairs(error_detail) do
+ for _, error_detail in pairs(M.error_detail) do
local captures = { line:match(error_detail.pattern) }
if #captures > 0 then
local utf8_filename = captures[error_detail.filename]
@@ -159,3 +165,5 @@ function goto_error(pos, line_num)
end
end
events.connect(events.DOUBLE_CLICK, goto_error)
+
+return M
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index 00d73b56..0bab1b40 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -2,9 +2,12 @@
local L = locale.localize
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Session support for the textadept module.
-module('_m.textadept.session', package.seeall)
+module('_m.textadept.session', package.seeall)]]
-- Markdown:
-- ## Settings
@@ -17,9 +20,9 @@ module('_m.textadept.session', package.seeall)
-- files list to save to the session. The default is `10`.
-- settings
-DEFAULT_SESSION = _USERHOME..'/session'
-SAVE_ON_QUIT = true
-MAX_RECENT_FILES = 10
+M.DEFAULT_SESSION = _USERHOME..'/session'
+M.SAVE_ON_QUIT = true
+M.MAX_RECENT_FILES = 10
-- end settings
---
@@ -30,9 +33,10 @@ MAX_RECENT_FILES = 10
-- `DEFAULT_SESSION` if not specified.
-- @return `true` if the session file was opened and read; `false` otherwise.
-- @usage _m.textadept.session.load(filename)
-function load(filename)
+-- @name load
+function M.load(filename)
local not_found = {}
- local f = io.open(filename or DEFAULT_SESSION, 'rb')
+ local f = io.open(filename or M.DEFAULT_SESSION, 'rb')
if not f then io.close_all() return false end
local current_view, splits = 1, { [0] = {} }
local lfs_attributes = lfs.attributes
@@ -97,7 +101,7 @@ function load(filename)
return true
end
-- Load session when no args are present.
-events.connect('arg_none', function() if SAVE_ON_QUIT then load() end end)
+events.connect('arg_none', function() if M.SAVE_ON_QUIT then M.load() end end)
---
-- Saves a Textadept session to a file.
@@ -106,7 +110,8 @@ events.connect('arg_none', function() if SAVE_ON_QUIT then load() end end)
-- @param filename The absolute path to the session file to save. Defaults to
-- either the current session file or `DEFAULT_SESSION` if not specified.
-- @usage _m.textadept.session.save(filename)
-function save(filename)
+-- @name save
+function M.save(filename)
local session = {}
local buffer_line = "buffer: %d %d %d %s" -- anchor, cursor, line, filename
local split_line = "%ssplit%d: %s %d" -- level, number, type, size
@@ -155,11 +160,11 @@ function save(filename)
local size = gui.size
session[#session + 1] = ("size: %d %d"):format(size[1], size[2])
for i, filename in ipairs(io.recent_files) do
- if i > MAX_RECENT_FILES then break end
+ if i > M.MAX_RECENT_FILES then break end
session[#session + 1] = ("recent: %s"):format(filename)
end
-- Write the session.
- local f = io.open(filename or DEFAULT_SESSION, 'wb')
+ local f = io.open(filename or M.DEFAULT_SESSION, 'wb')
if f then
f:write(table.concat(session, '\n'))
f:close()
@@ -168,31 +173,36 @@ end
---
-- Prompts the user for a Textadept session to load.
-function prompt_load()
+-- @name prompt_load
+function M.prompt_load()
local utf8_filename = gui.dialog('fileselect',
'--title', L('Load Session'),
'--with-directory',
- DEFAULT_SESSION:match('.+[/\\]') or '',
+ M.DEFAULT_SESSION:match('.+[/\\]') or '',
'--with-file',
- DEFAULT_SESSION:match('[^/\\]+$') or '',
+ M.DEFAULT_SESSION:match('[^/\\]+$') or '',
'--no-newline')
- if #utf8_filename > 0 then load(utf8_filename:iconv(_CHARSET, 'UTF-8')) end
+ if #utf8_filename > 0 then M.load(utf8_filename:iconv(_CHARSET, 'UTF-8')) end
end
---
-- Prompts the user to save the current Textadept session to a file.
-function prompt_save()
+-- @name prompt_save
+function M.prompt_save()
local utf8_filename = gui.dialog('filesave',
'--title', L('Save Session'),
'--with-directory',
- DEFAULT_SESSION:match('.+[/\\]') or '',
+ M.DEFAULT_SESSION:match('.+[/\\]') or '',
'--with-file',
- DEFAULT_SESSION:match('[^/\\]+$') or '',
+ M.DEFAULT_SESSION:match('[^/\\]+$') or '',
'--no-newline')
- if #utf8_filename > 0 then save(utf8_filename:iconv(_CHARSET, 'UTF-8')) end
+ if #utf8_filename > 0 then M.save(utf8_filename:iconv(_CHARSET, 'UTF-8')) end
end
-events.connect(events.QUIT, function() if SAVE_ON_QUIT then save() end end, 1)
+events.connect(events.QUIT,
+ function() if M.SAVE_ON_QUIT then M.save() end end, 1)
-local function no_session() SAVE_ON_QUIT = false end
+local function no_session() M.SAVE_ON_QUIT = false end
args.register('-n', '--nosession', 0, no_session, 'No session functionality')
+
+return M
diff --git a/modules/textadept/snapopen.lua b/modules/textadept/snapopen.lua
index f06d9260..3d295730 100644
--- a/modules/textadept/snapopen.lua
+++ b/modules/textadept/snapopen.lua
@@ -2,9 +2,12 @@
local L = locale.localize
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Snapopen for the textadept module.
-module('_m.textadept.snapopen', package.seeall)
+module('_m.textadept.snapopen', package.seeall)]]
-- Markdown:
-- ## Settings
@@ -33,13 +36,13 @@ module('_m.textadept.snapopen', package.seeall)
-- snapopen(project_dir, { folders = { '%.hg' } }, true)
-- settings
-PATHS = {}
-DEFAULT_DEPTH = 4
-MAX = 1000
+M.PATHS = {}
+M.DEFAULT_DEPTH = 4
+M.MAX = 1000
-- end settings
local lfs_dir, lfs_attributes = lfs.dir, lfs.attributes
-local DEPTH = DEFAULT_DEPTH
+local DEPTH = M.DEFAULT_DEPTH
-- Determines whether or not the given file matches the given filter.
-- @param file The filename.
@@ -66,7 +69,7 @@ end
-- @param depth The current depth of nested folders.
-- @param filter The filter table.
local function add_directory(utf8_dir, list, depth, filter)
- local string_match, string_gsub, MAX = string.match, string.gsub, MAX
+ local string_match, string_gsub, MAX = string.match, string.gsub, M.MAX
local dir = utf8_dir:iconv(_CHARSET, 'UTF-8')
for file in lfs_dir(dir) do
if not string_match(file, '^%.%.?$') then
@@ -101,26 +104,29 @@ end
-- @usage _m.textadept.snapopen.open(buffer.filename:match('^.+/'), nil, true)
-- @usage _m.textadept.snapopen.open(nil, '!%.lua$')
-- @usage _m.textadept.snapopen.open(nil, { folders = { '%.hg' } })
-function open(utf8_paths, filter, exclusive, depth)
+-- @name open
+function M.open(utf8_paths, filter, exclusive, depth)
if not utf8_paths then utf8_paths = {} end
if type(utf8_paths) == 'string' then utf8_paths = { utf8_paths } end
if not filter then filter = {} end
if type(filter) == 'string' then filter = { filter } end
if not exclusive then
- for _, path in ipairs(PATHS) do utf8_paths[#utf8_paths + 1] = path end
+ for _, path in ipairs(M.PATHS) do utf8_paths[#utf8_paths + 1] = path end
end
- DEPTH = depth or DEFAULT_DEPTH
+ DEPTH = depth or M.DEFAULT_DEPTH
local list = {}
for _, path in ipairs(utf8_paths) do add_directory(path, list, 1, filter) end
- if #list >= MAX then
+ if #list >= M.MAX then
gui.dialog('ok-msgbox',
'--title', L('File Limit Exceeded'),
'--informative-text',
- string.format('%d %s %d', MAX,
+ string.format('%d %s %d', M.MAX,
L('files or more were found. Showing the first'),
- MAX))
+ M.MAX))
end
local utf8_filenames = gui.filteredlist(L('Open'), L('File'), list, false,
'--select-multiple') or ''
for filename in utf8_filenames:gmatch('[^\n]+') do io.open_file(filename) end
end
+
+return M
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index 8e849ece..883b0fcf 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -2,9 +2,12 @@
local L = locale.localize
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Provides Lua-style snippets for Textadept.
-module('_m.textadept.snippets', package.seeall)
+module('_m.textadept.snippets', package.seeall)]]
-- Markdown:
-- ## Overview
@@ -137,7 +140,7 @@ local function new_snippet(text, trigger)
trigger = trigger,
original_sel_text = buffer:get_sel_text(),
snapshots = {}
- }, { __index = _snippet_mt })
+ }, { __index = M._snippet_mt })
snippet_stack[#snippet_stack + 1] = snippet
-- Convert and match indentation.
@@ -175,7 +178,8 @@ end
-- @param text Optional snippet text. If none is specified, the snippet text
-- is determined from the trigger and lexer.
-- @return `false` if no snippet was expanded; `true` otherwise.
-function _insert(text)
+-- @name _insert
+function M._insert(text)
local buffer = buffer
local trigger
if not text then
@@ -197,7 +201,8 @@ end
-- Goes back to the previous placeholder, reverting any changes from the current
-- one.
-- @return `false` if no snippet is active; `nil` otherwise.
-function _previous()
+-- @name _previous
+function M._previous()
if #snippet_stack == 0 then return false end
snippet_stack[#snippet_stack]:previous()
end
@@ -205,14 +210,16 @@ end
---
-- Cancels the active snippet, reverting to the state before its activation, and
-- restores the previously running snippet (if any).
-function _cancel_current()
+-- @name _cancel_current
+function M._cancel_current()
if #snippet_stack > 0 then snippet_stack[#snippet_stack]:cancel() end
end
---
-- Prompts the user to select a snippet to insert from a filtered list dialog.
-- Global snippets and snippets in the current lexer are shown.
-function _select()
+-- @name _select
+function M._select()
local list = {}
local type = type
for trigger, text in pairs(snippets) do
@@ -235,7 +242,7 @@ function _select()
local i = gui.filteredlist(L('Select Snippet'),
{ L('Trigger'), L('Scope'), L('Snippet Text') },
t, true, '--output-column', '2')
- if i then _insert(t[(i + 1) * 3]) end
+ if i then M._insert(t[(i + 1) * 3]) end
end
-- Table of escape sequences.
@@ -252,7 +259,7 @@ local escapes = {
-- Metatable for a snippet object.
-- @class table
-- @name _snippet_mt
-_snippet_mt = {
+M._snippet_mt = {
-- Gets a snippet's end position in the buffer.
-- @param snippet The snippet returned by `new_snippet()`.
get_end_position = function(snippet)
@@ -427,4 +434,6 @@ events.connect(events.VIEW_NEW,
-- Provides access to snippets from `_G`.
-- @class table
-- @name _G.snippets
-_G.snippets = _M
+_G.snippets = M
+
+return M
diff --git a/scripts/gen_iface.lua b/scripts/gen_iface.lua
index c520445c..8c0ef2d0 100755
--- a/scripts/gen_iface.lua
+++ b/scripts/gen_iface.lua
@@ -22,10 +22,13 @@ f = io.open('../core/iface.lua', 'w')
f:write [[
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Scintilla constants, functions, and properties.
-- Do not modify anything in this module. Doing so will result in instability.
-module('_SCINTILLA')
+module('_SCINTILLA')]]
]]
@@ -92,7 +95,7 @@ f:write [[
-- Scintilla constants.
-- @class table
-- @name constants
-constants = {]]
+M.constants = {]]
f:write(table.concat(constants, ','))
f:write('}\n\n')
@@ -114,7 +117,7 @@ f:write [[
-- Scintilla functions.
-- @class table
-- @name functions
-functions = {]]
+M.functions = {]]
f:write(table.concat(functions, ','))
f:write('}\n\n')
@@ -136,7 +139,7 @@ f:write [[
-- Scintilla properties.
-- @class table
-- @name properties
-properties = {]]
+M.properties = {]]
f:write(table.concat(properties, ','))
f:write('}\n\n')
@@ -150,7 +153,8 @@ local marker_number, indic_number, list_type = -1, 7, 0
-- identifiers of other custom markers.
-- @usage local marknum = _SCINTILLA.next_marker_number()
-- @see buffer.marker_define
-function next_marker_number()
+-- @name next_marker_number
+function M.next_marker_number()
marker_number = marker_number + 1
return marker_number
end
@@ -161,7 +165,8 @@ end
-- identifiers of other custom indicators.
-- @usage local indic_num = _SCINTILLA.next_indic_number()
-- @see buffer.indic_style
-function next_indic_number()
+-- @name next_indic_number
+function M.next_indic_number()
indic_number = indic_number + 1
return indic_number
end
@@ -172,10 +177,13 @@ end
-- type identifiers of other custom user lists.
-- @usage local list_type = _SCINTILLA.next_user_list_type()
-- @see buffer.user_list_show
-function next_user_list_type()
+-- @name next_user_list_type
+function M.next_user_list_type()
list_type = list_type + 1
return list_type
end
+
+return M
]]
f:close()