summaryrefslogtreecommitdiff
path: root/lang_ext/lua/upb.c
diff options
context:
space:
mode:
Diffstat (limited to 'lang_ext/lua/upb.c')
-rw-r--r--lang_ext/lua/upb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lang_ext/lua/upb.c b/lang_ext/lua/upb.c
index 7241dc5..bfc1355 100644
--- a/lang_ext/lua/upb.c
+++ b/lang_ext/lua/upb.c
@@ -71,6 +71,7 @@ static void lupb_def_getorcreate(lua_State *L, upb_def *def) {
break;
default:
luaL_error(L, "unknown deftype %d", def->type);
+ type_name = NULL; // Placate the compiler.
}
return lupb_cache_getorcreate(L, def, type_name, lupb_def_unref);
}
@@ -219,6 +220,9 @@ int luaopen_upb(lua_State *L) {
// Create our object cache. TODO: need to make this table weak!
lua_createtable(L, 0, 0);
+ lua_createtable(L, 0, 1); // Cache metatable.
+ lua_pushstring(L, "v"); // Values are weak.
+ lua_setfield(L, -2, "__mode");
lua_setfield(L, LUA_REGISTRYINDEX, "upb.objcache");
luaL_register(L, "upb", lupb_toplevel_m);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback