Skip to content

Commit

Permalink
perf: Simplify the function eco_new_metatable
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed Feb 13, 2025
1 parent faee5bb commit fb4b9da
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@

static inline void eco_new_metatable(lua_State *L, const char *name, const struct luaL_Reg regs[])
{
const struct luaL_Reg *reg;

if (!luaL_newmetatable(L, name))
return;

Expand All @@ -90,13 +88,7 @@ static inline void eco_new_metatable(lua_State *L, const char *name, const struc
if (!regs)
return;

reg = regs;

while (reg->name) {
lua_pushcfunction(L, reg->func);
lua_setfield(L, -2, reg->name);
reg++;
}
luaL_setfuncs(L, regs, 0);
}

#endif

0 comments on commit fb4b9da

Please sign in to comment.