aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lgc.c b/lgc.c
index f8f43393..253a2892 100644
--- a/lgc.c
+++ b/lgc.c
@@ -542,10 +542,12 @@ static void traversestrongtable (global_State *g, Table *h) {
542static lu_mem traversetable (global_State *g, Table *h) { 542static lu_mem traversetable (global_State *g, Table *h) {
543 const char *weakkey, *weakvalue; 543 const char *weakkey, *weakvalue;
544 const TValue *mode = gfasttm(g, h->metatable, TM_MODE); 544 const TValue *mode = gfasttm(g, h->metatable, TM_MODE);
545 TString *smode;
545 markobjectN(g, h->metatable); 546 markobjectN(g, h->metatable);
546 if (mode && ttisstring(mode) && /* is there a weak mode? */ 547 if (mode && ttisshrstring(mode) && /* is there a weak mode? */
547 (cast_void(weakkey = strchr(svalue(mode), 'k')), 548 (cast_void(smode = tsvalue(mode)),
548 cast_void(weakvalue = strchr(svalue(mode), 'v')), 549 cast_void(weakkey = strchr(getshrstr(smode), 'k')),
550 cast_void(weakvalue = strchr(getshrstr(smode), 'v')),
549 (weakkey || weakvalue))) { /* is really weak? */ 551 (weakkey || weakvalue))) { /* is really weak? */
550 if (!weakkey) /* strong keys? */ 552 if (!weakkey) /* strong keys? */
551 traverseweakvalue(g, h); 553 traverseweakvalue(g, h);