diff options
| author | Roberto I <roberto@inf.puc-rio.br> | 2026-07-22 13:43:40 -0300 |
|---|---|---|
| committer | Roberto I <roberto@inf.puc-rio.br> | 2026-07-22 13:43:40 -0300 |
| commit | d5bbe955840c5c83e37ed19df4d392d7ba0970ed (patch) | |
| tree | 35977691aabb3a65e96508d4277c2067991ee4e3 | |
| parent | 9130ceb19d324472d135e8e644a01e8b16334c31 (diff) | |
| download | lua-d5bbe955840c5c83e37ed19df4d392d7ba0970ed.tar.gz lua-d5bbe955840c5c83e37ed19df4d392d7ba0970ed.tar.bz2 lua-d5bbe955840c5c83e37ed19df4d392d7ba0970ed.zip | |
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.
| -rw-r--r-- | lapi.c | 6 | ||||
| -rw-r--r-- | luaconf.h | 2 | ||||
| -rw-r--r-- | lvm.c | 2 | ||||
| -rwxr-xr-x | manual/2html | 7 | ||||
| -rw-r--r-- | manual/manual.of | 10 |
5 files changed, 18 insertions, 9 deletions
| @@ -1210,7 +1210,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
| 1210 | else if (g->GCdebt >= n - MAX_LMEM) /* no overflow? */ | 1210 | else if (g->GCdebt >= n - MAX_LMEM) /* no overflow? */ |
| 1211 | newdebt = g->GCdebt - n; | 1211 | newdebt = g->GCdebt - n; |
| 1212 | else /* overflow */ | 1212 | else /* overflow */ |
| 1213 | newdebt = -MAX_LMEM; /* set debt to miminum value */ | 1213 | newdebt = -MAX_LMEM; /* set debt to mininum value */ |
| 1214 | luaE_setdebt(g, newdebt); | 1214 | luaE_setdebt(g, newdebt); |
| 1215 | luaC_condGC(L, (void)0, work = 1); | 1215 | luaC_condGC(L, (void)0, work = 1); |
| 1216 | if (work && g->gcstate == GCSpause) /* end of cycle? */ | 1216 | if (work && g->gcstate == GCSpause) /* end of cycle? */ |
| @@ -1299,8 +1299,8 @@ LUA_API void lua_toclose (lua_State *L, int idx) { | |||
| 1299 | 1299 | ||
| 1300 | LUA_API void lua_concat (lua_State *L, int n) { | 1300 | LUA_API void lua_concat (lua_State *L, int n) { |
| 1301 | lua_lock(L); | 1301 | lua_lock(L); |
| 1302 | api_checknelems(L, n); | ||
| 1303 | if (n > 0) { | 1302 | if (n > 0) { |
| 1303 | api_checkpop(L, n); | ||
| 1304 | luaV_concat(L, n); | 1304 | luaV_concat(L, n); |
| 1305 | luaC_checkGC(L); | 1305 | luaC_checkGC(L); |
| 1306 | } | 1306 | } |
| @@ -1418,7 +1418,7 @@ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { | |||
| 1418 | TValue *fi; | 1418 | TValue *fi; |
| 1419 | lua_lock(L); | 1419 | lua_lock(L); |
| 1420 | fi = index2value(L, funcindex); | 1420 | fi = index2value(L, funcindex); |
| 1421 | api_checknelems(L, 1); | 1421 | api_checkpop(L, 1); |
| 1422 | name = aux_upvalue(fi, n, &val, &owner); | 1422 | name = aux_upvalue(fi, n, &val, &owner); |
| 1423 | if (name) { | 1423 | if (name) { |
| 1424 | L->top.p--; | 1424 | L->top.p--; |
| @@ -79,7 +79,7 @@ | |||
| 79 | #if defined(LUA_USE_MACOSX) | 79 | #if defined(LUA_USE_MACOSX) |
| 80 | #define LUA_USE_POSIX | 80 | #define LUA_USE_POSIX |
| 81 | #define LUA_USE_DLOPEN /* macOS does not need -ldl */ | 81 | #define LUA_USE_DLOPEN /* macOS does not need -ldl */ |
| 82 | #define LUA_USE_READLINE | 82 | #define LUA_USE_READLINE /* needs an extra library: -lreadline */ |
| 83 | #endif | 83 | #endif |
| 84 | 84 | ||
| 85 | 85 | ||
| @@ -925,7 +925,7 @@ void luaV_finishOp (lua_State *L) { | |||
| 925 | ** Macros for arithmetic/bitwise/comparison opcodes in 'luaV_execute' | 925 | ** Macros for arithmetic/bitwise/comparison opcodes in 'luaV_execute' |
| 926 | ** | 926 | ** |
| 927 | ** All these macros are to be used exclusively inside the main | 927 | ** All these macros are to be used exclusively inside the main |
| 928 | ** iterpreter loop (function luaV_execute) and may access directly | 928 | ** interpreter loop (function luaV_execute) and may access directly |
| 929 | ** the local variables of that function (L, i, pc, ci, etc.). | 929 | ** the local variables of that function (L, i, pc, ci, etc.). |
| 930 | ** =================================================================== | 930 | ** =================================================================== |
| 931 | */ | 931 | */ |
diff --git a/manual/2html b/manual/2html index 243f3f22..23f37ac6 100755 --- a/manual/2html +++ b/manual/2html | |||
| @@ -58,7 +58,7 @@ end | |||
| 58 | 58 | ||
| 59 | local function compose (f,g) | 59 | local function compose (f,g) |
| 60 | assert(f and g) | 60 | assert(f and g) |
| 61 | return function (s) return g(f(s)) end | 61 | return function (...) return g(f(...)) end |
| 62 | end | 62 | end |
| 63 | 63 | ||
| 64 | local function concat (f, g) | 64 | local function concat (f, g) |
| @@ -395,9 +395,10 @@ APIEntry = function (e) | |||
| 395 | local apiicmd, ne = string.match(e, "^(.-</span>)(.*)") | 395 | local apiicmd, ne = string.match(e, "^(.-</span>)(.*)") |
| 396 | --io.stderr:write(e) | 396 | --io.stderr:write(e) |
| 397 | if not apiicmd then | 397 | if not apiicmd then |
| 398 | return antipara(Tag.hr() .. Tag.h3(a)) .. Tag.pre(h) .. e | 398 | return antipara(Tag.hr() .. Tag.h3(a)) .. Tag.pre(h, {class="api"}) .. e |
| 399 | else | 399 | else |
| 400 | return antipara(Tag.hr() .. Tag.h3(a)) .. apiicmd .. Tag.pre(h) .. ne | 400 | return antipara(Tag.hr() .. Tag.h3(a)) .. apiicmd .. |
| 401 | Tag.pre(h, {class="api"}) .. ne | ||
| 401 | end | 402 | end |
| 402 | end, | 403 | end, |
| 403 | 404 | ||
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 <const>, _G | |||
| 1728 | X = 1 -- ERROR | 1728 | X = 1 -- ERROR |
| 1729 | _ENV.X = 1 -- Ok | 1729 | _ENV.X = 1 -- Ok |
| 1730 | _G.print(X) -- Ok | 1730 | _G.print(X) -- Ok |
| 1731 | foo() -- 'foo' can freely change any global | 1731 | foo() -- 'foo' can freely change any global |
| 1732 | } | 1732 | } |
| 1733 | 1733 | ||
| 1734 | A chunk is also a block @see{chunks}, | 1734 | A chunk is also a block @see{chunks}, |
| @@ -6071,6 +6071,14 @@ In both cases, | |||
| 6071 | the function pushes onto the stack the final value associated | 6071 | the function pushes onto the stack the final value associated |
| 6072 | with @id{tname} in the registry. | 6072 | with @id{tname} in the registry. |
| 6073 | 6073 | ||
| 6074 | Usage note: Beware the use of the return value of this function to | ||
| 6075 | conditionally initializes the new metatable | ||
| 6076 | (e.g., by adding metamethods to it). | ||
| 6077 | If the initialization raises an error, | ||
| 6078 | the metatable will not be properly initialized, | ||
| 6079 | but a subsequent execution of that code will detect that the | ||
| 6080 | metatable already exists and then skip the initialization. | ||
| 6081 | |||
| 6074 | } | 6082 | } |
| 6075 | 6083 | ||
| 6076 | @APIEntry{lua_State *luaL_newstate (void);| | 6084 | @APIEntry{lua_State *luaL_newstate (void);| |
