mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-08 15:34:09 +00:00
refactor with luaL_setmetatable
This commit is contained in:
parent
96e2c7007a
commit
1fd4377ffc
@ -193,8 +193,7 @@ static void **ll_register(lua_State *L, const char *path)
|
|||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
plib = (void **)lua_newuserdata(L, sizeof(void *));
|
plib = (void **)lua_newuserdata(L, sizeof(void *));
|
||||||
*plib = NULL;
|
*plib = NULL;
|
||||||
luaL_getmetatable(L, "_LOADLIB");
|
luaL_setmetatable(L, "_LOADLIB");
|
||||||
lua_setmetatable(L, -2);
|
|
||||||
lua_pushfstring(L, "LOADLIB: %s", path);
|
lua_pushfstring(L, "LOADLIB: %s", path);
|
||||||
lua_pushvalue(L, -2);
|
lua_pushvalue(L, -2);
|
||||||
lua_settable(L, LUA_REGISTRYINDEX);
|
lua_settable(L, LUA_REGISTRYINDEX);
|
||||||
|
Loading…
Reference in New Issue
Block a user