diff options
Diffstat (limited to 'src/gnu/lgnu.c')
-rw-r--r-- | src/gnu/lgnu.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/gnu/lgnu.c b/src/gnu/lgnu.c index b937a81..c5da82e 100644 --- a/src/gnu/lgnu.c +++ b/src/gnu/lgnu.c @@ -140,7 +140,7 @@ static int compile_regex (lua_State *L, const TArgComp *argC, TGnu **pud) { ud->errmsg = res; ret = generate_error (L, ud, 0); } else { - lua_pushvalue (L, LUA_ENVIRONINDEX); + lua_pushvalue (L, ALG_ENVIRONINDEX); lua_setmetatable (L, -2); if (pud) *pud = ud; @@ -306,17 +306,6 @@ static const luaL_Reg r_functions[] = { /* Open the library */ REX_API int REX_OPENLIB (lua_State *L) { - /* create a new function environment to serve as a metatable for methods */ - lua_newtable (L); - lua_pushvalue (L, -1); - lua_replace (L, LUA_ENVIRONINDEX); - lua_pushvalue(L, -1); /* mt.__index = mt */ - lua_setfield(L, -2, "__index"); - luaL_register (L, NULL, r_methods); - - /* register functions */ - luaL_register (L, REX_LIBNAME, r_functions); - lua_pushliteral (L, REX_VERSION" (for GNU regexes)"); - lua_setfield (L, -2, "_VERSION"); + alg_register(L, r_methods, r_functions, "GNU regexes"); return 1; } |