| 13028 | |
| 13029 | |
| 13030 | static void **ll_register (lua_State *L, const char *path) { |
| 13031 | void **plib; |
| 13032 | lua_pushfstring(L, "%s%s", LIBPREFIX, path); |
| 13033 | lua_gettable(L, LUA_REGISTRYINDEX); /* check library in registry? */ |
| 13034 | if (!lua_isnil(L, -1)) /* is there an entry? */ |
| 13035 | plib = (void **)lua_touserdata(L, -1); |
| 13036 | else { /* no entry yet; create one */ |
| 13037 | lua_pop(L, 1); |
| 13038 | plib = (void **)lua_newuserdata(L, sizeof(const void *)); |
| 13039 | *plib = NULL; |
| 13040 | luaL_getmetatable(L, "_LOADLIB"); |
| 13041 | lua_setmetatable(L, -2); |
| 13042 | lua_pushfstring(L, "%s%s", LIBPREFIX, path); |
| 13043 | lua_pushvalue(L, -2); |
| 13044 | lua_settable(L, LUA_REGISTRYINDEX); |
| 13045 | } |
| 13046 | return plib; |
| 13047 | } |
| 13048 | |
| 13049 | |
| 13050 | /* |
no test coverage detected