next()

next (table [, index]) Allows a program to traverse all fields of a table. Its first argument is a table and its second argument is an index in this table. next returns the next index of the table and its associated value. When called with nil as its second argument, next returns an initial index and its associated 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

string.unpack()

string.unpack (fmt, s [, pos]) Returns the values packed in string s (see string.pack) according to the format string fmt (see §6.4.2). An optional pos marks where to start reading in s (default is 1). After the read values, this function also returns the index of the first unread byte in s.

math.exp()

math.exp (x) Returns the value ex (where e is the base of natural logarithms).

lua_newuserdata

lua_newuserdata[-0, +1, m] void *lua_newuserdata (lua_State *L, size_t size); This function allocates a new block of memory with the given size, pushes onto the stack a new full userdata with the block address, and returns this address. The host program can freely use this memory.

Local Declarations

3.3.7 – Local Declarations Local variables can be declared anywhere inside a block. The declaration can include an initial assignment: stat ::= local namelist [‘=’ explist] If present, an initial assignment has the same semantics of a multiple assignment (see §3.3.3). Otherwise, all variables are initialized with nil. A chunk is also a block (see §3.3.2), and so local variables can be declared in a chunk outside any explicit block. The visibility rules for local variables are explained i

lua_error

lua_error[-1, +0, v] int lua_error (lua_State *L); Generates a Lua error, using the value at the top of the stack as the error object. This function does a long jump, and therefore never returns (see luaL_error).

io.write()

io.write (···) Equivalent to io.output():write(···).

luaL_pushresult

luaL_pushresult[-?, +1, m] void luaL_pushresult (luaL_Buffer *B); Finishes the use of buffer B leaving the final string on the top of the stack.

math.sin()

math.sin (x) Returns the sine of x (assumed to be in radians).

lua_numbertointeger

lua_numbertointeger int lua_numbertointeger (lua_Number n, lua_Integer *p); Converts a Lua float to a Lua integer. This macro assumes that n has an integral value. If that value is within the range of Lua integers, it is converted to an integer and assigned to *p. The macro results in a boolean indicating whether the conversion was successful. (Note that this range test can be tricky to do correctly without this macro, due to roundings.) This macro may evaluate its arguments more than once.