aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lcode.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lcode.c b/lcode.c
index b0a81421..4caa8046 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1370,9 +1370,11 @@ void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {
1370 fillidxk(t, k->u.info, VINDEXUP); /* literal short string */ 1370 fillidxk(t, k->u.info, VINDEXUP); /* literal short string */
1371 } 1371 }
1372 else if (t->k == VVARGVAR) { /* indexing the vararg parameter? */ 1372 else if (t->k == VVARGVAR) { /* indexing the vararg parameter? */
1373 lua_assert(t->u.ind.t == fs->f->numparams); 1373 int kreg = luaK_exp2anyreg(fs, k); /* put key in some register */
1374 t->u.ind.t = cast_byte(t->u.var.ridx); 1374 lu_byte vreg = cast_byte(t->u.var.ridx); /* register with vararg param. */
1375 fillidxk(t, luaK_exp2anyreg(fs, k), VVARGIND); /* register */ 1375 lua_assert(vreg == fs->f->numparams);
1376 t->u.ind.t = vreg; /* (avoid a direct assignment; values may overlap) */
1377 fillidxk(t, kreg, VVARGIND); /* 't' represents 'vararg[k]' */
1376 } 1378 }
1377 else { 1379 else {
1378 /* register index of the table */ 1380 /* register index of the table */