mirror of
https://github.com/lua/lua.git
synced 2026-07-24 06:59:06 +00:00
Details
- Some api_checknelems changed to the more restrict api_checkpop. - Added a class to the html for APIs in the manual. - Comments and manual.
This commit is contained in:
6
lapi.c
6
lapi.c
@@ -1210,7 +1210,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) {
|
||||
else if (g->GCdebt >= n - MAX_LMEM) /* no overflow? */
|
||||
newdebt = g->GCdebt - n;
|
||||
else /* overflow */
|
||||
newdebt = -MAX_LMEM; /* set debt to miminum value */
|
||||
newdebt = -MAX_LMEM; /* set debt to mininum value */
|
||||
luaE_setdebt(g, newdebt);
|
||||
luaC_condGC(L, (void)0, work = 1);
|
||||
if (work && g->gcstate == GCSpause) /* end of cycle? */
|
||||
@@ -1299,8 +1299,8 @@ LUA_API void lua_toclose (lua_State *L, int idx) {
|
||||
|
||||
LUA_API void lua_concat (lua_State *L, int n) {
|
||||
lua_lock(L);
|
||||
api_checknelems(L, n);
|
||||
if (n > 0) {
|
||||
api_checkpop(L, n);
|
||||
luaV_concat(L, n);
|
||||
luaC_checkGC(L);
|
||||
}
|
||||
@@ -1418,7 +1418,7 @@ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {
|
||||
TValue *fi;
|
||||
lua_lock(L);
|
||||
fi = index2value(L, funcindex);
|
||||
api_checknelems(L, 1);
|
||||
api_checkpop(L, 1);
|
||||
name = aux_upvalue(fi, n, &val, &owner);
|
||||
if (name) {
|
||||
L->top.p--;
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
#if defined(LUA_USE_MACOSX)
|
||||
#define LUA_USE_POSIX
|
||||
#define LUA_USE_DLOPEN /* macOS does not need -ldl */
|
||||
#define LUA_USE_READLINE
|
||||
#define LUA_USE_READLINE /* needs an extra library: -lreadline */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
2
lvm.c
2
lvm.c
@@ -925,7 +925,7 @@ void luaV_finishOp (lua_State *L) {
|
||||
** Macros for arithmetic/bitwise/comparison opcodes in 'luaV_execute'
|
||||
**
|
||||
** All these macros are to be used exclusively inside the main
|
||||
** iterpreter loop (function luaV_execute) and may access directly
|
||||
** interpreter loop (function luaV_execute) and may access directly
|
||||
** the local variables of that function (L, i, pc, ci, etc.).
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
@@ -58,7 +58,7 @@ end
|
||||
|
||||
local function compose (f,g)
|
||||
assert(f and g)
|
||||
return function (s) return g(f(s)) end
|
||||
return function (...) return g(f(...)) end
|
||||
end
|
||||
|
||||
local function concat (f, g)
|
||||
@@ -395,9 +395,10 @@ APIEntry = function (e)
|
||||
local apiicmd, ne = string.match(e, "^(.-</span>)(.*)")
|
||||
--io.stderr:write(e)
|
||||
if not apiicmd then
|
||||
return antipara(Tag.hr() .. Tag.h3(a)) .. Tag.pre(h) .. e
|
||||
return antipara(Tag.hr() .. Tag.h3(a)) .. Tag.pre(h, {class="api"}) .. e
|
||||
else
|
||||
return antipara(Tag.hr() .. Tag.h3(a)) .. apiicmd .. Tag.pre(h) .. ne
|
||||
return antipara(Tag.hr() .. Tag.h3(a)) .. apiicmd ..
|
||||
Tag.pre(h, {class="api"}) .. ne
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
@@ -1728,7 +1728,7 @@ global X <const>, _G
|
||||
X = 1 -- ERROR
|
||||
_ENV.X = 1 -- Ok
|
||||
_G.print(X) -- Ok
|
||||
foo() -- 'foo' can freely change any global
|
||||
foo() -- 'foo' can freely change any global
|
||||
}
|
||||
|
||||
A chunk is also a block @see{chunks},
|
||||
@@ -6071,6 +6071,14 @@ In both cases,
|
||||
the function pushes onto the stack the final value associated
|
||||
with @id{tname} in the registry.
|
||||
|
||||
Usage note: Beware the use of the return value of this function to
|
||||
conditionally initializes the new metatable
|
||||
(e.g., by adding metamethods to it).
|
||||
If the initialization raises an error,
|
||||
the metatable will not be properly initialized,
|
||||
but a subsequent execution of that code will detect that the
|
||||
metatable already exists and then skip the initialization.
|
||||
|
||||
}
|
||||
|
||||
@APIEntry{lua_State *luaL_newstate (void);|
|
||||
|
||||
Reference in New Issue
Block a user