This commit is contained in:
Cloud Wu
2019-03-14 09:54:40 +08:00
parent 1d4308f33a
commit 3f38a711ad
8 changed files with 64 additions and 21 deletions

View File

@@ -119,7 +119,9 @@ static void LoadConstants (LoadState *S, Proto *f) {
int i;
int n = LoadInt(S);
f->k = luaM_newvector(S->L, n, TValue);
f->sp->k = f->k;
f->sp->sizek = n;
f->sp->sharedk = 1;
for (i = 0; i < n; i++)
setnilvalue(&f->k[i]);
for (i = 0; i < n; i++) {
@@ -139,6 +141,8 @@ static void LoadConstants (LoadState *S, Proto *f) {
setivalue(o, LoadInteger(S));
break;
case LUA_TSHRSTR:
f->sp->sharedk = 0;
//fall-through
case LUA_TLNGSTR:
setsvalue2n(S->L, o, LoadString(S));
break;