aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto I <roberto@inf.puc-rio.br>2026-04-21 15:27:22 -0300
committerRoberto I <roberto@inf.puc-rio.br>2026-04-21 15:27:22 -0300
commit0c16a42d61d08266033ff63bc5dfade6312b7359 (patch)
treeb67ddc660dc7d3c7ad7b30810a7b797b8943e341
parentd0bd25d2e7fb393a6d0a73645a099f9c3b9cc0a8 (diff)
downloadlua-0c16a42d61d08266033ff63bc5dfade6312b7359.tar.gz
lua-0c16a42d61d08266033ff63bc5dfade6312b7359.tar.bz2
lua-0c16a42d61d08266033ff63bc5dfade6312b7359.zip
Details
Added compiler option LUA_NODEBUGLIB to make Lua with no open debug library + small improvements in the manual.
-rw-r--r--lua.c8
-rw-r--r--manual/manual.of24
2 files changed, 21 insertions, 11 deletions
diff --git a/lua.c b/lua.c
index 3107a674..858a04c0 100644
--- a/lua.c
+++ b/lua.c
@@ -714,7 +714,13 @@ static void doREPL (lua_State *L) {
714/* }================================================================== */ 714/* }================================================================== */
715 715
716#if !defined(luai_openlibs) 716#if !defined(luai_openlibs)
717#define luai_openlibs(L) luaL_openselectedlibs(L, ~0, 0) 717#if defined(LUA_NODEBUGLIB)
718/* With this option, code must require the debug library before using it */
719#define luai_openlibs(L) luaL_openselectedlibs(L, ~LUA_DBLIBK, LUA_DBLIBK)
720#else
721/* The default is to open all standard libraries */
722#define luai_openlibs(L) luaL_openselectedlibs(L, ~0, 0)
723#endif
718#endif 724#endif
719 725
720 726
diff --git a/manual/manual.of b/manual/manual.of
index 5eb2fb1f..5e113336 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -3962,8 +3962,8 @@ this confuses the next call to @Lid{lua_next}.
3962 3962
3963This function may raise an error if the given key 3963This function may raise an error if the given key
3964is neither @nil nor present in the table. 3964is neither @nil nor present in the table.
3965See function @Lid{next} for the caveats of modifying 3965
3966the table during its traversal. 3966See function @Lid{next} for more details about the traversal.
3967 3967
3968} 3968}
3969 3969
@@ -4448,7 +4448,7 @@ Starts and resumes a coroutine in the given thread @id{L}.
4448To start a coroutine, 4448To start a coroutine,
4449you push the main function plus any arguments 4449you push the main function plus any arguments
4450onto the empty stack of the thread. 4450onto the empty stack of the thread.
4451then you call @Lid{lua_resume}, 4451Then you call @Lid{lua_resume},
4452with @id{nargs} being the number of arguments. 4452with @id{nargs} being the number of arguments.
4453The function returns when the coroutine suspends, 4453The function returns when the coroutine suspends,
4454finishes its execution, or raises an unprotected error. 4454finishes its execution, or raises an unprotected error.
@@ -4628,7 +4628,7 @@ You can resume threads with status @Lid{LUA_OK}
4628} 4628}
4629 4629
4630@APIEntry{size_t lua_stringtonumber (lua_State *L, const char *s);| 4630@APIEntry{size_t lua_stringtonumber (lua_State *L, const char *s);|
4631@apii{0,1,-} 4631@apii{0,0|1,-}
4632 4632
4633Converts the zero-terminated string @id{s} to a number, 4633Converts the zero-terminated string @id{s} to a number,
4634pushes that number into the stack, 4634pushes that number into the stack,
@@ -4958,7 +4958,7 @@ Lua calls the given @x{continuation function} @id{k} to continue
4958the execution of the @N{C function} that yielded @see{continuations}. 4958the execution of the @N{C function} that yielded @see{continuations}.
4959This continuation function receives the same stack 4959This continuation function receives the same stack
4960from the previous function, 4960from the previous function,
4961with the @id{n} results removed and 4961with all the results (@id{nresults}) removed and
4962replaced by the arguments passed to @Lid{lua_resume}. 4962replaced by the arguments passed to @Lid{lua_resume}.
4963Moreover, 4963Moreover,
4964the continuation function receives the value @id{ctx} 4964the continuation function receives the value @id{ctx}
@@ -5048,7 +5048,7 @@ the function was defined in a string where
5048} 5048}
5049 5049
5050@item{@id{srclen}| 5050@item{@id{srclen}|
5051The length of the string @id{source}. 5051the length of the string @id{source}.
5052} 5052}
5053 5053
5054@item{@id{short_src}| 5054@item{@id{short_src}|
@@ -5212,7 +5212,7 @@ running at the given level;
5212} 5212}
5213 5213
5214@item{@Char{S}| 5214@item{@Char{S}|
5215fills in the fields @id{source}, @id{short_src}, 5215fills in the fields @id{source}, @id{srclen}, @id{short_src},
5216@id{linedefined}, @id{lastlinedefined}, and @id{what}; 5216@id{linedefined}, @id{lastlinedefined}, and @id{what};
5217} 5217}
5218 5218
@@ -5388,7 +5388,9 @@ Returns @id{NULL} (and pops nothing)
5388when the index is greater than 5388when the index is greater than
5389the number of active local variables. 5389the number of active local variables.
5390 5390
5391Parameters @id{ar} and @id{n} are as in the function @Lid{lua_getlocal}. 5391Parameters @id{ar} and @id{n} are as in the function @Lid{lua_getlocal},
5392except that @id{ar} cannot be @id{NULL},
5393as @id{lua_setlocal} only operates on activation records.
5392 5394
5393} 5395}
5394 5396
@@ -6832,8 +6834,7 @@ for k,v in pairs(t) do @rep{body} end
6832} 6834}
6833will iterate over all key@En{}value pairs of table @id{t}. 6835will iterate over all key@En{}value pairs of table @id{t}.
6834 6836
6835See function @Lid{next} for the caveats of modifying 6837See function @Lid{next} for more details about the traversal.
6836the table during its traversal.
6837 6838
6838} 6839}
6839 6840
@@ -9123,6 +9124,7 @@ which automatically removes the file when the program ends.
9123 9124
9124This library provides 9125This library provides
9125the functionality of the @link{debugI|debug interface} to Lua programs. 9126the functionality of the @link{debugI|debug interface} to Lua programs.
9127
9126You should exert care when using this library. 9128You should exert care when using this library.
9127Several of its functions 9129Several of its functions
9128violate basic assumptions about Lua code 9130violate basic assumptions about Lua code
@@ -9132,6 +9134,8 @@ that userdata metatables cannot be changed by Lua code;
9132that Lua programs do not crash) 9134that Lua programs do not crash)
9133and therefore can compromise otherwise secure code. 9135and therefore can compromise otherwise secure code.
9134Moreover, some functions in this library may be slow. 9136Moreover, some functions in this library may be slow.
9137It is good practice to always require this library explicitly
9138before using it.
9135 9139
9136All functions in this library are provided 9140All functions in this library are provided
9137inside the @defid{debug} table. 9141inside the @defid{debug} table.