diff options
| author | ame <[email protected]> | 2025-06-12 13:57:51 -0500 |
|---|---|---|
| committer | ame <[email protected]> | 2025-06-12 13:57:51 -0500 |
| commit | fe09d3576ada9918f55431298c5d9a099e690761 (patch) | |
| tree | 32fc93c956154a0cdc6a760f3acca1263d4feb2a /src/reg.c | |
| parent | 8e7257aac8b30aaa57577770fd636e784361e35d (diff) | |
rewrite mimetype parsing
Diffstat (limited to 'src/reg.c')
| -rw-r--r-- | src/reg.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -12,7 +12,12 @@ int luaopen_lullaby_##name (lua_State* L){\
luaL_register(L, #name, name##_function_list);\
int tidx = lua_gettop(L);\
- i_config_metatable(L, name##_config);\
+ int idx = i_config_metatable(L, name##_config);\
+ lua_pushvalue(L, idx);\
+ lua_getmetatable(L, -1);\
+ int midx = lua_gettop(L);\
+ luaI_tsetcf(L, midx, "__gc", clean_lullaby_##name);\
+ lua_setmetatable(L, idx);\
lua_settop(L, tidx);\
return 1;\
}
@@ -29,7 +34,7 @@ open_common(test); lua_pushstring(L, #name);\
luaopen_lullaby_##name(L);\
lua_settable(L, T);
-
+
int luaopen_lullaby(lua_State* L) {
lua_newtable(L);
@@ -42,7 +47,7 @@ int luaopen_lullaby(lua_State* L) { push(top, net);
push(top, thread);
push(top, test);
- luaI_tsets(L, top, "version", GIT_COMMIT)
+ luaI_tsets(L, top, "version", GIT_COMMIT);
lua_settop(L, top);
return 1;
|
