aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/lapi.c b/lapi.c
index 34e64af1..2e27bc92 100644
--- a/lapi.c
+++ b/lapi.c
@@ -637,16 +637,16 @@ LUA_API int lua_pushthread (lua_State *L) {
637 637
638 638
639l_sinline int auxgetstr (lua_State *L, const TValue *t, const char *k) { 639l_sinline int auxgetstr (lua_State *L, const TValue *t, const char *k) {
640 const TValue *slot; 640 int aux;
641 TString *str = luaS_new(L, k); 641 TString *str = luaS_new(L, k);
642 if (luaV_fastget(L, t, str, slot, luaH_getstr)) { 642 luaV_fastget1(t, str, s2v(L->top.p), luaH_getstr1, aux);
643 setobj2s(L, L->top.p, slot); 643 if (aux == HOK) {
644 api_incr_top(L); 644 api_incr_top(L);
645 } 645 }
646 else { 646 else {
647 setsvalue2s(L, L->top.p, str); 647 setsvalue2s(L, L->top.p, str);
648 api_incr_top(L); 648 api_incr_top(L);
649 luaV_finishget(L, t, s2v(L->top.p - 1), L->top.p - 1, slot); 649 luaV_finishget1(L, t, s2v(L->top.p - 1), L->top.p - 1, aux);
650 } 650 }
651 lua_unlock(L); 651 lua_unlock(L);
652 return ttype(s2v(L->top.p - 1)); 652 return ttype(s2v(L->top.p - 1));
@@ -672,15 +672,13 @@ LUA_API int lua_getglobal (lua_State *L, const char *name) {
672 672
673 673
674LUA_API int lua_gettable (lua_State *L, int idx) { 674LUA_API int lua_gettable (lua_State *L, int idx) {
675 const TValue *slot; 675 int aux;
676 TValue *t; 676 TValue *t;
677 lua_lock(L); 677 lua_lock(L);
678 t = index2value(L, idx); 678 t = index2value(L, idx);
679 if (luaV_fastget(L, t, s2v(L->top.p - 1), slot, luaH_get)) { 679 luaV_fastget1(t, s2v(L->top.p - 1), s2v(L->top.p - 1), luaH_get1, aux);
680 setobj2s(L, L->top.p - 1, slot); 680 if (aux != HOK)
681 } 681 luaV_finishget1(L, t, s2v(L->top.p - 1), L->top.p - 1, aux);
682 else
683 luaV_finishget(L, t, s2v(L->top.p - 1), L->top.p - 1, slot);
684 lua_unlock(L); 682 lua_unlock(L);
685 return ttype(s2v(L->top.p - 1)); 683 return ttype(s2v(L->top.p - 1));
686} 684}
@@ -694,16 +692,14 @@ LUA_API int lua_getfield (lua_State *L, int idx, const char *k) {
694 692
695LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { 693LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) {
696 TValue *t; 694 TValue *t;
697 const TValue *slot; 695 int aux;
698 lua_lock(L); 696 lua_lock(L);
699 t = index2value(L, idx); 697 t = index2value(L, idx);
700 if (luaV_fastgeti(L, t, n, slot)) { 698 luaV_fastgeti1(t, n, s2v(L->top.p), aux);
701 setobj2s(L, L->top.p, slot); 699 if (aux != HOK) {
702 } 700 TValue key;
703 else { 701 setivalue(&key, n);
704 TValue aux; 702 luaV_finishget1(L, t, &key, L->top.p, aux);
705 setivalue(&aux, n);
706 luaV_finishget(L, t, &aux, L->top.p, slot);
707 } 703 }
708 api_incr_top(L); 704 api_incr_top(L);
709 lua_unlock(L); 705 lua_unlock(L);