소스 검색

Manual: errors in lua_toclose are not memory errors

Roberto Ierusalimschy 1 년 전
부모
커밋
cbdf4969ec
3개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      lauxlib.c
  2. 1 1
      liolib.c
  3. 4 1
      manual/manual.of

+ 1 - 1
lauxlib.c

@@ -951,7 +951,7 @@ LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) {
 LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
   luaL_checkstack(L, nup, "too many upvalues");
   for (; l->name != NULL; l++) {  /* fill the table with given functions */
-    if (l->func == NULL)  /* place holder? */
+    if (l->func == NULL)  /* placeholder? */
       lua_pushboolean(L, 0);
     else {
       int i;

+ 1 - 1
liolib.c

@@ -773,7 +773,7 @@ static const luaL_Reg meth[] = {
 ** metamethods for file handles
 */
 static const luaL_Reg metameth[] = {
-  {"__index", NULL},  /* place holder */
+  {"__index", NULL},  /* placeholder */
   {"__gc", f_gc},
   {"__close", f_gc},
   {"__tostring", f_tostring},

+ 4 - 1
manual/manual.of

@@ -4475,7 +4475,7 @@ otherwise, returns @id{NULL}.
 }
 
 @APIEntry{void lua_toclose (lua_State *L, int index);|
-@apii{0,0,m}
+@apii{0,0,v}
 
 Marks the given index in the stack as a
 to-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
 by any other function in the API except @Lid{lua_settop} or @Lid{lua_pop},
 unless previously deactivated by @Lid{lua_closeslot}.
 
+This function raises an error if the value at the given slot
+neither has a @idx{__close} metamethod nor is a false value.
+
 This function should not be called for an index
 that is equal to or below an active to-be-closed slot.