aboutsummaryrefslogtreecommitdiff
path: root/modules/lua/api
diff options
context:
space:
mode:
Diffstat (limited to 'modules/lua/api')
-rw-r--r--modules/lua/api/_G.luadoc64
-rw-r--r--modules/lua/api/coroutine.luadoc10
-rw-r--r--modules/lua/api/debug.luadoc18
-rw-r--r--modules/lua/api/io.luadoc50
-rw-r--r--modules/lua/api/math.luadoc48
-rw-r--r--modules/lua/api/os.luadoc24
-rw-r--r--modules/lua/api/string.luadoc33
-rw-r--r--modules/lua/api/table.luadoc22
8 files changed, 269 insertions, 0 deletions
diff --git a/modules/lua/api/_G.luadoc b/modules/lua/api/_G.luadoc
new file mode 100644
index 00000000..45fbe8fc
--- /dev/null
+++ b/modules/lua/api/_G.luadoc
@@ -0,0 +1,64 @@
+-- * `_G`: Holds global environment, setfenv changes environments.
+-- * `_VERSION`: Current interpreter version "Lua 5.0".
+--- Error if v nil or false, otherwise returns v.
+function assert(v [, message])
+--- Set threshold to limit KBytes, default 0, may run GC.
+function collectgarbage([limit])
+--- Executes as Lua chunk, default stdin, returns value.
+function dofile(filename)
+--- Terminates protected func, never returns, level 1(default), 2=parent.
+function error(message [, level])
+--- Returns dynamic mem in use(KB), and current GC threshold(KB).
+function gcinfo()
+---
+-- Gets env, f can be a function or number(stack level, default=1), 0=global
+-- env.
+function getfenv(f)
+--- Returns metatable of given object, otherwise nil.
+function getmetatable(object)
+--- Returns an iterator function, table t and 0.
+function ipairs(t)
+---
+-- Loads chunk without execution, returns chunk as function, else nil plus
+-- error.
+function loadfile(filename)
+--- Links to dynamic library libname, returns funcname as a C function.
+function loadlib(libname, funcname)
+--- Loads string as chunk, returns chunk as function, else nil plus error.
+function loadstring(string [, chunkname])
+--- Returns next index,value pair, if index=nil(default), returns first index.
+function next(table [, index])
+---
+-- Returns the next function and table t plus a nil, iterates over all key-value
+-- pairs.
+function pairs(t)
+---
+-- Protected mode call, catches errors, returns status code first
+--(true=success).
+function pcall(f, arg1, arg2, ...)
+--- Prints values to stdout using tostring.
+function print(e1, e2, ...)
+--- Non-metamethod v1==v2, returns boolean.
+function rawequal(v1, v2)
+--- Non-metamethod get value of table[index], index != nil.
+function rawget(table, index)
+--- Non-metamethod set value of table[index], index != nil.
+function rawset(table, index, value)
+--- Loads package, updates _LOADED, returns boolean.
+function require(packagename)
+---
+-- Sets env, f can be a function or number(stack level, default=1), 0=global
+-- env.
+function setfenv(f, table)
+--- Sets metatable, nil to remove metatable.
+function setmetatable(table, metatable)
+--- Convert to number, returns number, nil if non-convertible, 2<=base<=36.
+function tonumber(e [, base])
+--- Convert to string, returns string.
+function tostring(e)
+--- Returns type of v as a string.
+function type(v)
+--- Returns all elements from list.
+function unpack(list)
+--- pcall function f with new error handler err.
+function xpcall(f, err)
diff --git a/modules/lua/api/coroutine.luadoc b/modules/lua/api/coroutine.luadoc
new file mode 100644
index 00000000..7e60f275
--- /dev/null
+++ b/modules/lua/api/coroutine.luadoc
@@ -0,0 +1,10 @@
+--- Creates coroutine from function f, returns coroutine.
+function create(f)
+-- Continues execution of co, returns bool status plus any values.
+function resume(co, val1, ...)
+--- Returns co status: "running", "suspended" or "dead".
+function status(co)
+--- Creates coroutine with body f, returns function that resumes co.
+function wrap(f)
+--- Suspend execution of calling coroutine.
+function yield(val1, ...)
diff --git a/modules/lua/api/debug.luadoc b/modules/lua/api/debug.luadoc
new file mode 100644
index 00000000..fb7c83f3
--- /dev/null
+++ b/modules/lua/api/debug.luadoc
@@ -0,0 +1,18 @@
+--- Enters interactive debug mode, line with only "cont" terminates.
+function debug()
+--- Returns current hook function, hook mask, hook count.
+function gethook()
+--- Returns table with information about a function.
+function getinfo(function [, what])
+--- Returns name and value of local variable with index local at stack level.
+function getlocal(level, local)
+--- Returns name and value of upvalue with index up of function func.
+function getupvalue(func, up)
+--- Sets given function as a hook, mask="[crl]".
+function sethook(hook, mask [, count])
+--- Sets local variable with index local at stack level with value.
+function setlocal(level, local, value)
+--- Sets upvalue with index up of function func with value.
+function setupvalue(func, up, value)
+--- Returns a string with a traceback of the call stack.
+function traceback([message])
diff --git a/modules/lua/api/io.luadoc b/modules/lua/api/io.luadoc
new file mode 100644
index 00000000..adf4edfe
--- /dev/null
+++ b/modules/lua/api/io.luadoc
@@ -0,0 +1,50 @@
+--- Closes file, or the default output file.
+function close([file])
+--- Flushes the default output file.
+function flush()
+---
+-- Opens file in text mode, sets as default input file, or returns current
+-- default input file.
+function input([file])
+--- Open file in read mode, returns iterator function to return lines, nil ends.
+function lines([filename])
+--- Opens file in specified mode "[rawb+]", returns handle or nil.
+function open(filename [, mode])
+---
+-- Opens file in text mode, sets as default output file, or returns current
+-- default output file.
+function output([file])
+--- Reads file according to given formats, returns read values or nil.
+function read(format1, ...)
+-- * `stderr`: File descriptor for STDERR.
+-- * `stdin`: File descriptor for STDIN.
+-- * `stdout`: File descriptor for STDOUT.
+--- Returns a handle for a temporary file, opened in update mode.
+function tmpfile()
+---
+-- Returns "file" if obj is an open file handle, "close file" if closed, or nil
+-- if not a file handle.
+function type(obj)
+--- Writes strings or numbers to file.
+function write(value1, ...)
+
+---
+-- Opens a list of files.
+-- @param utf8_filenames A '\n' separated list of filenames to open. If none
+-- specified, the user is prompted to open files from a dialog. These paths
+-- must be encoded in UTF-8.
+-- @usage io.open_file(utf8_encoded_filename)
+function open_file(utf8_filenames)
+
+---
+-- Saves all dirty buffers to their respective files.
+-- @usage io.save_all()
+function save_all()
+
+---
+-- Closes all open buffers.
+-- If any buffer is dirty, the user is prompted to continue. No buffers are
+-- saved automatically. They must be saved manually.
+-- @usage io.close_all()
+-- @return true if user did not cancel.
+function close_all()
diff --git a/modules/lua/api/math.luadoc b/modules/lua/api/math.luadoc
new file mode 100644
index 00000000..7c84a80e
--- /dev/null
+++ b/modules/lua/api/math.luadoc
@@ -0,0 +1,48 @@
+--- Returns absolute value of v.
+function abs(v)
+--- Returns arc cosine value of v in radians.
+function acos(v)
+--- Returns arc sine value of v in radians.
+function asin(v)
+--- Returns arc tangent value of v in radians.
+function atan(v)
+--- Returns arc tangent value of v1/v2 in radians.
+function atan2(v1, v2)
+--- Returns smallest integer >= v.
+function ceil(v)
+--- Returns cosine value of angle rad.
+function cos(rad)
+--- Returns angle in degrees of radians rad.
+function deg(rad)
+--- Returns e^v.
+function exp(v)
+--- Returns largest integer <= v.
+function floor(v)
+--- Returns mantissa [0.5,1) and exponent values of v.
+function frexp(v)
+--- Returns v1*2^v2.
+function ldexp(v1, v2)
+--- Returns natural logarithm of v.
+function log(v)
+--- Returns logarithm 10 of v.
+function log10(v)
+--- Returns maximum in a list of one or more values.
+function max(v1, ...)
+--- Returns minimum in a list of one or more values.
+function min(v1, ...)
+--- Returns remainder of v1/v2 which is v1 - iV2 for some integer i.
+function mod(v1, v2)
+--- Returns v1 raised to the power of v2.
+function pow(v1, v2)
+--- Returns angle in radians of degrees deg.
+function rad(deg)
+--- Returns random real [0,1), integer [1,n] or real [1,u](with n=1).
+function random([n [, u]])
+--- Sets seed for pseudo-random number generator.
+function randomseed(seed)
+--- Returns sine value of angle rad .
+function sin(rad)
+--- Returns square root of v.
+function sqrt(v)
+--- Returns tangent value of angle rad.
+function tan(rad)
diff --git a/modules/lua/api/os.luadoc b/modules/lua/api/os.luadoc
new file mode 100644
index 00000000..cb8ca275
--- /dev/null
+++ b/modules/lua/api/os.luadoc
@@ -0,0 +1,24 @@
+--- Returns CPU time used by program in seconds.
+function clock()
+--- Returns a string or table containing date and time, "*t" returns a table.
+function date([format [, time]])
+--- Returns number of seconds from time t1 to time t2.
+function difftime(t2, t1)
+--- Executes command using C function system, returns status code.
+function execute(command)
+--- Terminates host program with optional code, default is success code.
+function exit([code])
+--- Returns value of environment variable varname. nil if not defined.
+function getenv(varname)
+--- Deletes file with given name, nil if fails.
+function remove(filename)
+--- Renames file oldname to newname, nil if fails.
+function rename(oldname, newname)
+--- Set current locale of program, returns name of new locate or nil.
+function setlocale(locale [, category])
+--- Returns current time(usually seconds) or time as represented by table.
+function time([table])
+---
+-- Returns a string with a filename for a temporary file(dangerous! tmpfile is
+-- better).
+function tmpname()
diff --git a/modules/lua/api/string.luadoc b/modules/lua/api/string.luadoc
new file mode 100644
index 00000000..e1f99e82
--- /dev/null
+++ b/modules/lua/api/string.luadoc
@@ -0,0 +1,33 @@
+--- Returns numerical code, nil if index out of range, default i=1.
+function byte(s [, i])
+--- Returns a string built from 0 or more integers.
+function char(i1, i2, ...)
+--- Returns binary representation of function, used with loadstring.
+function dump(function)
+--- Matches pattern in s, returns start,end indices, else nil.
+function find(s, pattern [, init [, plain]])
+--- Returns formatted string, printf-style.
+function format(formatstring, e1, e2, ...)
+--- Returns iterator function that returns next captures from pattern pat on s.
+function gfind(s, pat)
+--- Returns copy of s with pat replaced by repl, and substitutions made.
+function gsub(s, pat, repl [, n])
+--- Returns string length.
+function len(s)
+--- Returns string with letters in lower case.
+function lower(s)
+--- Returns string with n copies of string s.
+function rep(s, n)
+--- Returns substring from index i to j of s, default j=-1(string length).
+function sub(s, i [, j])
+--- Returns string with letters in upper case.
+function upper(s)
+
+---
+-- Converts a string from one character set to another using iconv().
+-- Valid character sets are ones GLib's g_convert() accepts, typically GNU
+-- iconv's character sets.
+-- @param text The text to convert.
+-- @param to The character set to convert to.
+-- @param from The character set to convert from.
+function iconv(text, to, from) end
diff --git a/modules/lua/api/table.luadoc b/modules/lua/api/table.luadoc
new file mode 100644
index 00000000..81f5a369
--- /dev/null
+++ b/modules/lua/api/table.luadoc
@@ -0,0 +1,22 @@
+--- Returns concatenated table elements i to j separated by sep.
+function concat(table [, sep [, i [, j]]])
+---
+-- Executes f(index,value) over all elements of table, returns first non-nil of
+-- f.
+function foreach(table, f)
+---
+-- Executes f(index,value) in sequential order 1 to n, returns first non-nil of
+-- f.
+function foreachi(table, f)
+---
+-- Returns size of table, or n field, or table.setn value, or 1 less first index
+-- with nil value.
+function getn(table)
+--- Insert value at location pos in table, default pos=n+1.
+function insert(table, [pos,] value)
+--- Removes element at pos from table, default pos=n.
+function remove(table [, pos])
+--- Sets size of table, n field of table if it exists.
+function setn(table, n)
+--- Sorts in-place elements 1 to n, comp(v1,v2) true if v1<v2, default <.
+function sort(table [, comp])