aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lgc.c2
-rw-r--r--manual/manual.of23
2 files changed, 20 insertions, 5 deletions
diff --git a/lgc.c b/lgc.c
index c834319b..8cb3e9fa 100644
--- a/lgc.c
+++ b/lgc.c
@@ -832,7 +832,7 @@ static void GCTM (lua_State *L) {
832 lua_assert(!g->gcemergency); 832 lua_assert(!g->gcemergency);
833 setgcovalue(L, &v, udata2finalize(g)); 833 setgcovalue(L, &v, udata2finalize(g));
834 tm = luaT_gettmbyobj(L, &v, TM_GC); 834 tm = luaT_gettmbyobj(L, &v, TM_GC);
835 if (ttisfunction(tm)) { /* is the finalizer a function? */ 835 if (!notm(tm)) { /* is there a finalizer? */
836 int status; 836 int status;
837 lu_byte oldah = L->allowhook; 837 lu_byte oldah = L->allowhook;
838 int running = g->gcrunning; 838 int running = g->gcrunning;
diff --git a/manual/manual.of b/manual/manual.of
index 63e78f95..1e4ca857 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -689,10 +689,8 @@ After the collection,
689Lua goes through that list. 689Lua goes through that list.
690For each object in the list, 690For each object in the list,
691it checks the object's @idx{__gc} metamethod: 691it checks the object's @idx{__gc} metamethod:
692If it is a function, 692If it is present,
693Lua calls it with the object as its single argument; 693Lua calls it with the object as its single argument.
694if the metamethod is not a function,
695Lua simply ignores it.
696 694
697At the end of each garbage-collection cycle, 695At the end of each garbage-collection cycle,
698the finalizers for objects are called in 696the finalizers for objects are called in
@@ -726,6 +724,9 @@ these marks have no effect.
726 724
727Finalizers cannot yield. 725Finalizers cannot yield.
728 726
727Any error while running a finalizer generates a warning;
728it is not propagated.
729
729} 730}
730 731
731@sect3{weak-table| @title{Weak Tables} 732@sect3{weak-table| @title{Weak Tables}
@@ -7279,6 +7280,11 @@ that is,
7279with maximum alignment of 1 (no alignment) 7280with maximum alignment of 1 (no alignment)
7280and native endianness. 7281and native endianness.
7281 7282
7283Native endianness assumes that the whole system is
7284either big or little endian.
7285The packing functions will not emulate correctly the behavior
7286of mixed-endian formats.
7287
7282Alignment works as follows: 7288Alignment works as follows:
7283For each option, 7289For each option,
7284the format gets extra padding until the data starts 7290the format gets extra padding until the data starts
@@ -7288,6 +7294,7 @@ this minimum must be a power of 2.
7288Options @St{c} and @St{z} are not aligned; 7294Options @St{c} and @St{z} are not aligned;
7289option @St{s} follows the alignment of its starting integer. 7295option @St{s} follows the alignment of its starting integer.
7290 7296
7297
7291All padding is filled with zeros by @Lid{string.pack} 7298All padding is filled with zeros by @Lid{string.pack}
7292(and ignored by @Lid{string.unpack}). 7299(and ignored by @Lid{string.unpack}).
7293 7300
@@ -8720,6 +8727,14 @@ name is visible, even if this other label is declared in an enclosing
8720block. 8727block.
8721} 8728}
8722 8729
8730@item{
8731When finalizing an object,
8732Lua does not ignore @idx{__gc} metamethods that are not functions.
8733Any value will be called, if present.
8734(Non-callable values will generate a warning,
8735like any other error when calling a finalizer.)
8736}
8737
8723} 8738}
8724 8739
8725} 8740}