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.
pairs({t}) *pairs()*
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}.
pcall({f}, {arg1}, {...}) *pcall()*
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.
print({...}) *print()*
Receives any number of arguments, and prints their values to `stdout`,
using the `tostring` |tostring()| function to convert them to
strings. `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` (see |string.format()|).
rawequal({v1}, {v2}) *rawequal()*
Checks whether {v1} is equal to {v2}, without invoking any metamethod.
Returns a boolean.
rawget({table}, {index}) *rawget()*
Gets the real value of `table[index]`, without invoking any
metamethod. {table} must be a table; {index} may be any value.
rawset({table}, {index}, {value}) *rawset()*
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.
This function returns {table}.
select({index}, {...}) *select()*
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.
setfenv({f}, {table}) *setfenv()*
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.
setmetatable({table}, {metatable}) *setmetatable()*
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}.
tonumber({e} [, {base}]) *tonumber()*
Tries to convert its argument to a number. If the argument is already
a number or a string convertible to a number, then `tonumber`