diff --git a/lapi.c b/lapi.c index fb994594..8bc2ddd1 100644 --- a/lapi.c +++ b/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--; diff --git a/luaconf.h b/luaconf.h index ea2c0b2e..bdac085c 100644 --- a/luaconf.h +++ b/luaconf.h @@ -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 diff --git a/lvm.c b/lvm.c index f83d47d1..986c7db8 100644 --- a/lvm.c +++ b/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.). ** =================================================================== */ diff --git a/manual/2html b/manual/2html index 243f3f22..23f37ac6 100755 --- a/manual/2html +++ b/manual/2html @@ -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, "^(.-)(.*)") --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, diff --git a/manual/manual.of b/manual/manual.of index 426ad453..e2d1a651 100644 --- a/manual/manual.of +++ b/manual/manual.of @@ -1728,7 +1728,7 @@ global X , _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);|