diff options
Diffstat (limited to 'lcode.c')
-rw-r--r-- | lcode.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -544,10 +544,10 @@ static int addk (FuncState *fs, TValue *key, TValue *v) { | |||
544 | TValue val; | 544 | TValue val; |
545 | lua_State *L = fs->ls->L; | 545 | lua_State *L = fs->ls->L; |
546 | Proto *f = fs->f; | 546 | Proto *f = fs->f; |
547 | const TValue *idx = luaH_get(fs->ls->h, key); /* query scanner table */ | 547 | int aux = luaH_get(fs->ls->h, key, &val); /* query scanner table */ |
548 | int k, oldsize; | 548 | int k, oldsize; |
549 | if (ttisinteger(idx)) { /* is there an index there? */ | 549 | if (aux == HOK && ttisinteger(&val)) { /* is there an index there? */ |
550 | k = cast_int(ivalue(idx)); | 550 | k = cast_int(ivalue(&val)); |
551 | /* correct value? (warning: must distinguish floats from integers!) */ | 551 | /* correct value? (warning: must distinguish floats from integers!) */ |
552 | if (k < fs->nk && ttypetag(&f->k[k]) == ttypetag(v) && | 552 | if (k < fs->nk && ttypetag(&f->k[k]) == ttypetag(v) && |
553 | luaV_rawequalobj(&f->k[k], v)) | 553 | luaV_rawequalobj(&f->k[k], v)) |
@@ -559,7 +559,7 @@ static int addk (FuncState *fs, TValue *key, TValue *v) { | |||
559 | /* numerical value does not need GC barrier; | 559 | /* numerical value does not need GC barrier; |
560 | table has no metatable, so it does not need to invalidate cache */ | 560 | table has no metatable, so it does not need to invalidate cache */ |
561 | setivalue(&val, k); | 561 | setivalue(&val, k); |
562 | luaH_finishset(L, fs->ls->h, key, idx, &val); | 562 | luaH_set(L, fs->ls->h, key, &val); |
563 | luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants"); | 563 | luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants"); |
564 | while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); | 564 | while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); |
565 | setobj(L, &f->k[k], v); | 565 | setobj(L, &f->k[k], v); |