aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-05-23 09:55:26 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-05-23 09:55:26 -0300
commitcbdf4969ec425f1df1ade358425c0bf0bf811d83 (patch)
treede6078c0cc8db2cf3cd70c3ab9cc8777c2db43c9
parent262dc5729a28b2bad0b6413d4eab2290d14395cf (diff)
downloadlua-cbdf4969ec425f1df1ade358425c0bf0bf811d83.tar.gz
lua-cbdf4969ec425f1df1ade358425c0bf0bf811d83.tar.bz2
lua-cbdf4969ec425f1df1ade358425c0bf0bf811d83.zip
Manual: errors in lua_toclose are not memory errors
Diffstat (limited to '')
-rw-r--r--lauxlib.c2
-rw-r--r--liolib.c2
-rw-r--r--manual/manual.of5
3 files changed, 6 insertions, 3 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 1f786e15..fec834d3 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -951,7 +951,7 @@ LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) {
951LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { 951LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
952 luaL_checkstack(L, nup, "too many upvalues"); 952 luaL_checkstack(L, nup, "too many upvalues");
953 for (; l->name != NULL; l++) { /* fill the table with given functions */ 953 for (; l->name != NULL; l++) { /* fill the table with given functions */
954 if (l->func == NULL) /* place holder? */ 954 if (l->func == NULL) /* placeholder? */
955 lua_pushboolean(L, 0); 955 lua_pushboolean(L, 0);
956 else { 956 else {
957 int i; 957 int i;
diff --git a/liolib.c b/liolib.c
index b08397da..6879a603 100644
--- a/liolib.c
+++ b/liolib.c
@@ -773,7 +773,7 @@ static const luaL_Reg meth[] = {
773** metamethods for file handles 773** metamethods for file handles
774*/ 774*/
775static const luaL_Reg metameth[] = { 775static const luaL_Reg metameth[] = {
776 {"__index", NULL}, /* place holder */ 776 {"__index", NULL}, /* placeholder */
777 {"__gc", f_gc}, 777 {"__gc", f_gc},
778 {"__close", f_gc}, 778 {"__close", f_gc},
779 {"__tostring", f_tostring}, 779 {"__tostring", f_tostring},
diff --git a/manual/manual.of b/manual/manual.of
index 5aea2623..f830b01c 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -4475,7 +4475,7 @@ otherwise, returns @id{NULL}.
4475} 4475}
4476 4476
4477@APIEntry{void lua_toclose (lua_State *L, int index);| 4477@APIEntry{void lua_toclose (lua_State *L, int index);|
4478@apii{0,0,m} 4478@apii{0,0,v}
4479 4479
4480Marks the given index in the stack as a 4480Marks the given index in the stack as a
4481to-be-closed slot @see{to-be-closed}. 4481to-be-closed slot @see{to-be-closed}.
@@ -4492,6 +4492,9 @@ A slot marked as to-be-closed should not be removed from the stack
4492by any other function in the API except @Lid{lua_settop} or @Lid{lua_pop}, 4492by any other function in the API except @Lid{lua_settop} or @Lid{lua_pop},
4493unless previously deactivated by @Lid{lua_closeslot}. 4493unless previously deactivated by @Lid{lua_closeslot}.
4494 4494
4495This function raises an error if the value at the given slot
4496neither has a @idx{__close} metamethod nor is a false value.
4497
4495This function should not be called for an index 4498This function should not be called for an index
4496that is equal to or below an active to-be-closed slot. 4499that is equal to or below an active to-be-closed slot.
4497 4500