20 | 20 |
-- want to control the step size you must experimentally tune the value of
|
21 | 21 |
-- * "arg". Returns true if the step finished a collection cycle.
|
22 | 22 |
-- * "setpause": sets `arg` as the new value for the *pause* of the collector
|
23 | |
-- (see §2.10). Returns the previous value for *pause*.
|
|
23 |
-- (see 2.10). Returns the previous value for *pause*.
|
24 | 24 |
-- * "setstepmul": sets `arg` as the new value for the *step multiplier*
|
25 | |
-- of the collector (see §2.10). Returns the previous value for *step*.
|
|
25 |
-- of the collector (see 2.10). Returns the previous value for *step*.
|
26 | 26 |
--
|
27 | 27 |
function collectgarbage(opt , arg) end
|
28 | 28 |
|
|
54 | 54 |
-- * `_G._G`: _G._G
|
55 | 55 |
|
56 | 56 |
---
|
57 | |
-- Returns the current environment in use by the function.
|
58 | |
-- `f` can be a Lua function or a number that specifies the function at that
|
59 | |
-- stack level: Level 1 is the function calling `getfenv`. If the given
|
60 | |
-- function is not a Lua function, or if `f` is 0, `getfenv` returns the
|
61 | |
-- global environment. The default for `f` is 1.
|
62 | |
function getfenv(f) end
|
63 | |
|
64 | |
---
|
65 | 57 |
-- If `object` does not have a metatable, returns nil. Otherwise, if the
|
66 | 58 |
-- object's metatable has a `"__metatable"` field, returns the associated
|
67 | 59 |
-- value. Otherwise, returns the metatable of the given object.
|
|
76 | 68 |
function ipairs(t) end
|
77 | 69 |
|
78 | 70 |
---
|
79 | |
-- Loads a chunk using function `func` to get its pieces. Each call to
|
80 | |
-- `func` must return a string that concatenates with previous results. A
|
81 | |
-- return of an empty string, nil, or no value signals the end of the chunk.
|
82 | |
-- If there are no errors, returns the compiled chunk as a function; otherwise,
|
83 | |
-- returns nil plus the error message. The environment of the returned function
|
84 | |
-- is the global environment.
|
85 | |
-- `chunkname` is used as the chunk name for error messages and debug
|
86 | |
-- information. When absent, it defaults to "`=(load)`".
|
87 | |
function load(func , chunkname) end
|
|
71 |
-- Loads a chunk.
|
|
72 |
-- If `ld` is a string, the chunk is this string.
|
|
73 |
-- If `ld` is a function, load calls it repeatedly to get the chunk pieces. Each call to `ld` must return a
|
|
74 |
-- string that concatenates with previous results. A return of an empty string, nil, or no value
|
|
75 |
-- signals the end of the chunk.
|
|
76 |
-- If there are no syntactic errors, returns the compiled chunk as a function;
|
|
77 |
-- otherwise, returns nil plus the error message.
|
|
78 |
-- If the resulting function has upvalues, the first upvalue is set to the value of the global environment or to `env`,
|
|
79 |
-- if that parameter is given. When loading main chunks, the first upvalue will be the`_ENV` variable (see 2.2).
|
|
80 |
-- `source` is used as the source of the chunk for error messages and debug information (see 4.9).
|
|
81 |
-- When absent, it defaults to `ld`, if `ld` is a string, or to "=(load)" otherwise.
|
|
82 |
-- The string `mode` controls whether the chunk can be text or binary (that is, a precompiled chunk).
|
|
83 |
-- It may be the string "b" (only binary chunks), "t" (only text chunks), or "bt" (both binary and text).
|
|
84 |
-- The default is "bt"
|
|
85 |
function load (ld [, source [, mode [, env]]]) end
|
88 | 86 |
|
89 | 87 |
---
|
90 | 88 |
-- Similar to `load`, but gets the chunk from file `filename` or from the
|
91 | 89 |
-- standard input, if no file name is given.
|
92 | |
function loadfile(filename) end
|
93 | |
|
94 | |
---
|
95 | |
-- Similar to `load`, but gets the chunk from the given string.
|
96 | |
-- To load and run a given string, use the idiom
|
97 | |
-- assert(loadstring(s))()
|
98 | |
-- When absent, `chunkname` defaults to the given string.
|
99 | |
function loadstring(string , chunkname) end
|
|
90 |
function loadfile ([filename [, mode [, env]]]) end
|
100 | 91 |
|
101 | 92 |
---
|
102 | 93 |
-- Allows a program to traverse all fields of a table. Its first argument is
|
|
166 | 157 |
-- `index`. Otherwise, `index` must be the string `"#"`, and `select` returns
|
167 | 158 |
-- the total number of extra arguments it received.
|
168 | 159 |
function select(index, ...) end
|
169 | |
|
170 | |
---
|
171 | |
-- Sets the environment to be used by the given function. `f` can be a Lua
|
172 | |
-- function or a number that specifies the function at that stack level: Level
|
173 | |
-- 1 is the function calling `setfenv`. `setfenv` returns the given function.
|
174 | |
-- As a special case, when `f` is 0 `setfenv` changes the environment of the
|
175 | |
-- running thread. In this case, `setfenv` returns no values.
|
176 | |
function setfenv(f, table) end
|
177 | 160 |
|
178 | 161 |
---
|
179 | 162 |
-- Sets the metatable for the given table. (You cannot change the metatable
|
|
192 | 175 |
-- letter '`A`' (in either upper or lower case) represents 10, '`B`' represents
|
193 | 176 |
-- 11, and so forth, with '`Z`' representing 35. In base 10 (the default),
|
194 | 177 |
-- the number can have a decimal part, as well as an optional exponent part
|
195 | |
-- (see §2.1). In other bases, only unsigned integers are accepted.
|
196 | |
function tonumber(e , base) end
|
|
178 |
-- (see 2.1). In other bases, only unsigned integers are accepted.
|
|
179 |
function tonumber(e [, base]) end
|
197 | 180 |
|
198 | 181 |
---
|
199 | 182 |
-- Receives an argument of any type and converts it to a string in a
|
|
210 | 193 |
-- `nil`" (a string, not the value nil), "`number`", "`string`", "`boolean`",
|
211 | 194 |
-- "`table`", "`function`", "`thread`", and "`userdata`".
|
212 | 195 |
function type(v) end
|
213 | |
|
214 | |
---
|
215 | |
-- Returns the elements from the given table. This function is equivalent to
|
216 | |
-- return list[i], list[i+1], ..., list[j]
|
217 | |
-- except that the above code can be written only for a fixed number of
|
218 | |
-- elements. By default, `i` is 1 and `j` is the length of the list, as
|
219 | |
-- defined by the length operator (see §2.5.5).
|
220 | |
function unpack(list , i , j) end
|
221 | 196 |
|
222 | 197 |
---
|
223 | 198 |
-- A global variable (not a function) that holds a string containing the
|
|
237 | 212 |
-- also returns all results from the call, after this first result. In case
|
238 | 213 |
-- of any error, `xpcall` returns false plus the result from `err`.
|
239 | 214 |
function xpcall(f, err) end
|
240 | |
|
241 | |
---
|
242 | |
-- Creates a module. If there is a table in `package.loaded[name]`,
|
243 | |
-- this table is the module. Otherwise, if there is a global table `t`
|
244 | |
-- with the given name, this table is the module. Otherwise creates a new
|
245 | |
-- table `t` and sets it as the value of the global `name` and the value of
|
246 | |
-- `package.loaded[name]`. This function also initializes `t._NAME` with the
|
247 | |
-- given name, `t._M` with the module (`t` itself), and `t._PACKAGE` with the
|
248 | |
-- package name (the full module name minus last component; see below). Finally,
|
249 | |
-- `module` sets `t` as the new environment of the current function and the
|
250 | |
-- new value of `package.loaded[name]`, so that `require` returns `t`.
|
251 | |
-- If `name` is a compound name (that is, one with components separated by
|
252 | |
-- dots), `module` creates (or reuses, if they already exist) tables for each
|
253 | |
-- component. For instance, if `name` is `a.b.c`, then `module` stores the
|
254 | |
-- module table in field `c` of field `b` of global `a`.
|
255 | |
-- This function can receive optional *options* after the module name, where
|
256 | |
-- each option is a function to be applied over the module.
|
257 | |
function module(name , ...) end
|
258 | 215 |
|
259 | 216 |
---
|
260 | 217 |
-- Loads the given module. The function starts by looking into the
|