Something went wrong. Try again.
OpenMW is an open implementation of the Morrowind engine
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265--------------------------------------------------------------------------------- Lua global variables.-- The basic library provides some core functions to Lua.-- All the preloaded module of Lua are declared here.-- @module global-------------------------------------------------------------------------------- This library provides generic functions for coroutine manipulation.-- This is a global variable which hold the preloaded @{coroutine} module.-- @field[parent = #global] coroutine#coroutine coroutine preloaded module-------------------------------------------------------------------------------- This library provides generic functions for string manipulation.-- This is a global variable which hold the preloaded @{string} module.-- @field[parent = #global] string#string string preloaded module-------------------------------------------------------------------------------- This library provides generic functions for table manipulation.-- This is a global variable which hold the preloaded @{table} module.-- @field[parent = #global] table#table table preloaded module-------------------------------------------------------------------------------- This library is an interface to the standard C math library.-- This is a global variable which hold the preloaded @{math} module.-- @field[parent = #global] math#math math preloaded module--------------------------------------------------------------------------------- Issues an error when the value of its argument `v` is false (i.e.,-- **nil** or **false**); otherwise, returns all its arguments. `message` is an error-- message; when absent, it defaults to *"assertion failed!"*.-- @function [parent=#global] assert-- @param v if this argument is false an error is issued.-- @param #string message an error message. defaults value is *"assertion failed"*.-- @return All its arguments.--------------------------------------------------------------------------------- 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.-- @function [parent=#global] error-- @param #string message an error message.-- @param #number level specifies how to get the error position, default value is `1`.--------------------------------------------------------------------------------- If `object` does not have a metatable, returns nil. Otherwise, if the-- object's metatable has a `"__metatable"` field, returns the associated-- value. Otherwise, returns the metatable of the given object.-- @function [parent=#global] getmetatable-- @param object-- @return #table the metatable of object.--------------------------------------------------------------------------------- Use to iterate over a table by index.-- 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-- first integer key absent from the table.-- @function [parent=#global] ipairs-- @param #table t a table by 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 `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.-- @function [parent=#global] next-- @param #table table table to traverse.-- @param index initial index.--------------------------------------------------------------------------------- Use to iterate over a table.-- 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 [parent=#global] pairs-- @param #table t table to traverse.--------------------------------------------------------------------------------- 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.-- @function [parent=#global] pcall-- @param f function to be call in *protected mode*.-- @param ... function arguments.-- @return #boolean true plus the result of `f` function if its call succeeds without errors.-- @return #boolean,#string false plus the error message in case of any error.--------------------------------------------------------------------------------- Receives any number of arguments, and prints their values to OpenMW log,-- using the `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`.-- -- @function [parent=#global] print-- @param ... values to print to `stdout`.--------------------------------------------------------------------------------- Checks whether `v1` is equal to `v2`, without invoking any-- metamethod. Returns a boolean.-- @function [parent=#global] rawequal-- @param v1-- @param v2-- @return #boolean true if `v1` is equal to `v2`. --------------------------------------------------------------------------------- Gets the real value of `table[index]`, without invoking any-- metamethod. `table` must be a table; `index` may be any value.-- @function [parent=#global] rawget-- @param #table table-- @param index may be any value.-- @return The real value of `table[index]`, without invoking any-- metamethod.--------------------------------------------------------------------------------- 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`.-- @function [parent=#global] rawset-- @param #table table-- @param index any value different from nil.-- @param value any Lua value.--------------------------------------------------------------------------------- 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.-- @function [parent=#global] select-- @param index a number or the string `"#"`-- @param ...--------------------------------------------------------------------------------- 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 [parent=#global] setmetatable-- @param #table table -- @param #table metatable-- @return The first argument `table`. --------------------------------------------------------------------------------- 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.-- In other bases, only unsigned integers are accepted.-- @function [parent=#global] tonumber-- @param e a number or string to convert to a number.-- @param #number base the base to interpret the numeral, any integer between 2 and 36.(default is 10).-- @return #number a number if conversion succeeds else **nil**.--------------------------------------------------------------------------------- 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 [parent=#global] tostring-- @param e an argument of any type.-- @return #string a string in a reasonable format.--------------------------------------------------------------------------------- Returns the type of its only argument, coded as a string. The possible-- results of this function are "-- `nil`" (a string, not the value nil), "`number`", "`string`", "`boolean`",-- "`table`", "`function`", "`thread`", and "`userdata`".-- @function [parent=#global] type-- @param v any value.-- @return #string the type of `v`.--------------------------------------------------------------------------------- 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.-- @function [parent=#global] unpack-- @param #table list a table by index-- @param i index of first value.-- @param j index of last value.--------------------------------------------------------------------------------- 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`".-- @field [parent = #global] #string _VERSION--------------------------------------------------------------------------------- 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 [parent=#global] xpcall-- @param f function to be call in *protected mode*.-- @param err function used as error handler.-- @return #boolean true plus the result of `f` function if its call succeeds without errors.-- @return #boolean,#string false plus the result of `err` function. --------------------------------------------------------------------------------- Loads the given module. -- If the requested module is one of the allowed standard libraries-- (`coroutine`, `math`, `string`, `table`), then returns the library.-- If it is one of the built-in OpenMW API packages, then returns the package.-- Otherwise it searches for a Lua source file with such name in OpenMW data folders.-- For example `require('my_lua_library.something')` will try to open the file-- `my_lua_library/something.lua`.---- Loading DLLs and precompiled Lua files is intentionally prohibited for reasons-- of safety and compatibility between different platforms.---- 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.-- @function [parent=#global] require-- @param #string modname name of module to load.return nil