Fix handling of nil value markers in template tables.

Thanks to Peter Cawley. #1348 #1155
This commit is contained in:
Mike Pall 2025-03-09 23:11:05 +01:00
parent e0551670c9
commit 7db2d1b12a

View File

@ -186,7 +186,7 @@ static void bcwrite_ktab(BCWriteCtx *ctx, char *p, const GCtab *t)
} else { } else {
MSize i = nhash; MSize i = nhash;
for (;; node--) for (;; node--)
if (!tvisnil(&node->key)) { if (!tvisnil(&node->val)) {
bcwrite_ktabk(ctx, &node->key, 0); bcwrite_ktabk(ctx, &node->key, 0);
bcwrite_ktabk(ctx, &node->val, 1); bcwrite_ktabk(ctx, &node->val, 1);
if (--i == 0) break; if (--i == 0) break;