@@ -389,7 +389,7 @@ LUA_API lua_Unsigned lua_rawlen (lua_State *L, int idx) {
389389 case LuaT::TABLE: {
390390 lua_Unsigned res;
391391 lua_lock (L);
392- res = luaH_getn (L, hvalue (o));
392+ res = hvalue (o)-> getn (L );
393393 lua_unlock (L);
394394 return res;
395395 }
@@ -614,7 +614,7 @@ LUA_API int lua_pushthread (lua_State *L) {
614614static int auxgetstr (lua_State *L, const TValue *t, const char *k) {
615615 LuaT tag;
616616 TString *str = TString::create (L, k);
617- tag = luaV_fastget (t, str, s2v (L->getTop ().p ), luaH_getstr );
617+ tag = luaV_fastget (t, str, s2v (L->getTop ().p ), [](Table* tbl, TString* strkey, TValue* res) { return tbl-> getStr (strkey, res); } );
618618 if (!tagisempty (tag))
619619 api_incr_top (L);
620620 else {
@@ -634,7 +634,7 @@ static int auxgetstr (lua_State *L, const TValue *t, const char *k) {
634634*/
635635static void getGlobalTable (lua_State *L, TValue *gt) {
636636 Table *registry = hvalue (G (L)->getRegistry ());
637- LuaT tag = luaH_getint ( registry, LUA_RIDX_GLOBALS, gt);
637+ LuaT tag = registry-> getInt ( LUA_RIDX_GLOBALS, gt);
638638 (void )tag; /* avoid not-used warnings when checks are off */
639639 api_check (L, novariant (tag) == LUA_TTABLE, " global table must exist" );
640640}
@@ -652,7 +652,7 @@ LUA_API int lua_gettable (lua_State *L, int idx) {
652652 lua_lock (L);
653653 api_checkpop (L, 1 );
654654 TValue *t = L->getStackSubsystem ().indexToValue (L,idx);
655- LuaT tag = luaV_fastget (t, s2v (L->getTop ().p - 1 ), s2v (L->getTop ().p - 1 ), luaH_get );
655+ LuaT tag = luaV_fastget (t, s2v (L->getTop ().p - 1 ), s2v (L->getTop ().p - 1 ), [](Table* tbl, const TValue* key, TValue* res) { return tbl-> get (key, res); } );
656656 if (tagisempty (tag))
657657 tag = luaV_finishget (L, t, s2v (L->getTop ().p - 1 ), L->getTop ().p - 1 , tag);
658658 lua_unlock (L);
@@ -702,7 +702,7 @@ LUA_API int lua_rawget (lua_State *L, int idx) {
702702 lua_lock (L);
703703 api_checkpop (L, 1 );
704704 Table *t = gettable (L, idx);
705- LuaT tag = luaH_get (t, s2v (L->getTop ().p - 1 ), s2v (L->getTop ().p - 1 ));
705+ LuaT tag = t-> get ( s2v (L->getTop ().p - 1 ), s2v (L->getTop ().p - 1 ));
706706 L->getStackSubsystem ().pop (); /* pop key */
707707 return finishrawget (L, tag);
708708}
@@ -712,7 +712,7 @@ LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) {
712712 lua_lock (L);
713713 Table *t = gettable (L, idx);
714714 LuaT tag;
715- luaH_fastgeti (t, n, s2v (L->getTop ().p ), tag);
715+ t-> fastGeti ( n, s2v (L->getTop ().p ), tag);
716716 return finishrawget (L, tag);
717717}
718718
@@ -722,17 +722,17 @@ LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p) {
722722 Table *t = gettable (L, idx);
723723 TValue k;
724724 setpvalue (&k, cast_voidp (p));
725- return finishrawget (L, luaH_get (t, &k, s2v (L->getTop ().p )));
725+ return finishrawget (L, t-> get ( &k, s2v (L->getTop ().p )));
726726}
727727
728728
729729LUA_API void lua_createtable (lua_State *L, int narray, int nrec) {
730730 lua_lock (L);
731- Table *t = luaH_new (L);
731+ Table *t = Table::create (L);
732732 sethvalue2s (L, L->getTop ().p , t);
733733 api_incr_top (L);
734734 if (narray > 0 || nrec > 0 )
735- luaH_resize (L, t , cast_uint (narray), cast_uint (nrec));
735+ t-> resize (L , cast_uint (narray), cast_uint (nrec));
736736 luaC_checkGC (L);
737737 lua_unlock (L);
738738}
@@ -796,7 +796,7 @@ static void auxsetstr (lua_State *L, const TValue *t, const char *k) {
796796 int hres;
797797 TString *str = TString::create (L, k);
798798 api_checkpop (L, 1 );
799- hres = luaV_fastset (t, str, s2v (L->getTop ().p - 1 ), luaH_psetstr );
799+ hres = luaV_fastset (t, str, s2v (L->getTop ().p - 1 ), [](Table* tbl, TString* strkey, TValue* val) { return tbl-> psetStr (strkey, val); } );
800800 if (hres == HOK) {
801801 luaV_finishfastset (L, t, s2v (L->getTop ().p - 1 ));
802802 L->getStackSubsystem ().pop (); /* pop value */
@@ -823,7 +823,7 @@ LUA_API void lua_settable (lua_State *L, int idx) {
823823 lua_lock (L);
824824 api_checkpop (L, 2 );
825825 TValue *t = L->getStackSubsystem ().indexToValue (L,idx);
826- int hres = luaV_fastset (t, s2v (L->getTop ().p - 2 ), s2v (L->getTop ().p - 1 ), luaH_pset );
826+ int hres = luaV_fastset (t, s2v (L->getTop ().p - 2 ), s2v (L->getTop ().p - 1 ), [](Table* tbl, const TValue* key, TValue* val) { return tbl-> pset (key, val); } );
827827 if (hres == HOK)
828828 luaV_finishfastset (L, t, s2v (L->getTop ().p - 1 ));
829829 else
@@ -861,7 +861,7 @@ static void aux_rawset (lua_State *L, int idx, TValue *key, int n) {
861861 lua_lock (L);
862862 api_checkpop (L, n);
863863 Table *t = gettable (L, idx);
864- luaH_set (L, t , key, s2v (L->getTop ().p - 1 ));
864+ t-> set (L , key, s2v (L->getTop ().p - 1 ));
865865 invalidateTMcache (t);
866866 luaC_barrierback (L, obj2gco (t), s2v (L->getTop ().p - 1 ));
867867 L->getStackSubsystem ().popN (n);
@@ -885,7 +885,7 @@ LUA_API void lua_rawseti (lua_State *L, int idx, lua_Integer n) {
885885 lua_lock (L);
886886 api_checkpop (L, 1 );
887887 Table *t = gettable (L, idx);
888- luaH_setint (L, t , n, s2v (L->getTop ().p - 1 ));
888+ t-> setInt (L , n, s2v (L->getTop ().p - 1 ));
889889 luaC_barrierback (L, obj2gco (t), s2v (L->getTop ().p - 1 ));
890890 L->getStackSubsystem ().pop ();
891891 lua_unlock (L);
@@ -1197,7 +1197,7 @@ LUA_API int lua_next (lua_State *L, int idx) {
11971197 lua_lock (L);
11981198 api_checkpop (L, 1 );
11991199 Table *t = gettable (L, idx);
1200- int more = luaH_next (L, t , L->getTop ().p - 1 );
1200+ int more = t-> tableNext (L , L->getTop ().p - 1 );
12011201 if (more)
12021202 api_incr_top (L);
12031203 else /* no more elements */
0 commit comments