diff options
Diffstat (limited to 'lobject.h')
-rw-r--r-- | lobject.h | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -21,10 +21,12 @@ | |||
21 | */ | 21 | */ |
22 | #define LUA_TUPVAL LUA_NUMTYPES /* upvalues */ | 22 | #define LUA_TUPVAL LUA_NUMTYPES /* upvalues */ |
23 | #define LUA_TPROTO (LUA_NUMTYPES+1) /* function prototypes */ | 23 | #define LUA_TPROTO (LUA_NUMTYPES+1) /* function prototypes */ |
24 | #define LUA_TDEADKEY (LUA_NUMTYPES+2) /* removed keys in tables */ | ||
25 | |||
24 | 26 | ||
25 | 27 | ||
26 | /* | 28 | /* |
27 | ** number of all possible types (including LUA_TNONE) | 29 | ** number of all possible types (including LUA_TNONE but excluding DEADKEY) |
28 | */ | 30 | */ |
29 | #define LUA_TOTALTYPES (LUA_TPROTO + 2) | 31 | #define LUA_TOTALTYPES (LUA_TPROTO + 2) |
30 | 32 | ||
@@ -555,7 +557,7 @@ typedef struct Proto { | |||
555 | 557 | ||
556 | /* | 558 | /* |
557 | ** {================================================================== | 559 | ** {================================================================== |
558 | ** Closures | 560 | ** Functions |
559 | ** =================================================================== | 561 | ** =================================================================== |
560 | */ | 562 | */ |
561 | 563 | ||
@@ -743,13 +745,13 @@ typedef struct Table { | |||
743 | 745 | ||
744 | 746 | ||
745 | /* | 747 | /* |
746 | ** Use a "nil table" to mark dead keys in a table. Those keys serve | 748 | ** Dead keys in tables have the tag DEADKEY but keep their original |
747 | ** to keep space for removed entries, which may still be part of | 749 | ** gcvalue. This distinguishes them from regular keys but allows them to |
748 | ** chains. Note that the 'keytt' does not have the BIT_ISCOLLECTABLE | 750 | ** be found when searched in a special way. ('next' needs that to find |
749 | ** set, so these values are considered not collectable and are different | 751 | ** keys removed from a table during a traversal.) |
750 | ** from any valid value. | ||
751 | */ | 752 | */ |
752 | #define setdeadkey(n) (keytt(n) = LUA_TTABLE, gckey(n) = NULL) | 753 | #define setdeadkey(node) (keytt(node) = LUA_TDEADKEY) |
754 | #define keyisdead(node) (keytt(node) == LUA_TDEADKEY) | ||
753 | 755 | ||
754 | /* }================================================================== */ | 756 | /* }================================================================== */ |
755 | 757 | ||