package.config

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 di

lua_touserdata

lua_touserdata[-0, +0, –] void *lua_touserdata (lua_State *L, int index); If the value at the given index is a full userdata, returns its block address. If the value is a light userdata, returns its pointer. Otherwise, returns NULL.

Blocks

3.3.1 – Blocks A block is a list of statements, which are executed sequentially: block ::= {stat} Lua has empty statements that allow you to separate statements with semicolons, start a block with a semicolon or write two semicolons in sequence: stat ::= ‘;’ Function calls and assignments can start with an open parenthesis. This possibility leads to an ambiguity in Lua's grammar. Consider the following fragment: a = b + c (print or io.write)('done') The grammar could see it in two ways:

lua_tointegerx

lua_tointegerx[-0, +0, –] lua_Integer lua_tointegerx (lua_State *L, int index, int *isnum); Converts the Lua value at the given index to the signed integral type lua_Integer. The Lua value must be an integer, or a number or string convertible to an integer (see §3.4.3); otherwise, lua_tointegerx returns 0. If isnum is not NULL, its referent is assigned a boolean value that indicates whether the operation succeeded.

luaL_prepbuffsize

luaL_prepbuffsize[-?, +?, m] char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz); Returns an address to a space of size sz where you can copy a string to be added to buffer B (see luaL_Buffer). After copying the string into this space you must call luaL_addsize with the size of the string to actually add it to the buffer.

lua_upvalueid

lua_upvalueid[-0, +0, –] void *lua_upvalueid (lua_State *L, int funcindex, int n); Returns a unique identifier for the upvalue numbered n from the closure at index funcindex. 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. Parameters funcindex and n are as in function lua_getupvalue, but n cannot be grea

math.random()

math.random ([m [, n]]) When called without arguments, returns a pseudo-random float with uniform distribution in the range [0,1). When called with two integers m and n, math.random returns a pseudo-random integer with uniform distribution in the range [m, n]. (The value n-m cannot be negative and must fit in a Lua integer.) The call math.random(n) is equivalent to math.random(1,n). This function is an interface to the underling pseudo-random generator function provided by C.

lua_next

lua_next[-1, +(2|0), e] int lua_next (lua_State *L, int index); Pops a key from the stack, and pushes a key–value pair from the table at the given index (the "next" pair after the given key). If there are no more elements in the table, then lua_next returns 0 (and pushes nothing). A typical traversal looks like this: /* table is in the stack at index 't' */ lua_pushnil(L); /* first key */ while (lua_next(L, t) != 0) { /* uses 'key' (at index -2) and 'value' (at index -1) */ printf("%

pcall()

pcall (f [, arg1, ···]) Calls function f with the given arguments in protected mode. This means that any error inside f is not propagated; instead, pcall catches the error and returns a status code. Its first result is the status code (a 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.

lua_tolstring

lua_tolstring[-0, +0, m] const char *lua_tolstring (lua_State *L, int index, size_t *len); Converts the Lua value at the given index to a C string. If len is not NULL, it sets *len with the string length. The Lua value must be a string or a number; otherwise, the function returns NULL. If the value is a number, then lua_tolstring also changes the actual value in the stack to a string. (This change confuses lua_next when lua_tolstring is applied to keys during a table traversal.) lua_tolstr