int luaopen_upb_c(lua_State *L) { static char module_key; if (lupb_openlib(L, &module_key, "upb_c", lupb_toplevel_m)) { return 1; } lupb_def_registertypes(L); lupb_msg_registertypes(L); return 1; /* Return package table. */ }
int luaopen_upbtable(lua_State *L) { static char module_key; if (lupb_openlib(L, &module_key, "upb.table", lupbtable_toplevel_m)) { return 1; } // We define these here because they are not public. lupbtable_setfieldi(L, "CTYPE_PTR", UPB_CTYPE_PTR); lupbtable_setfieldi(L, "CTYPE_CSTR", UPB_CTYPE_CSTR); lupbtable_setfieldi(L, "CTYPE_INT32", UPB_CTYPE_INT32); lua_pushlightuserdata(L, NULL); lua_setfield(L, -2, "NULL"); return 1; // Return a single Lua value, the package table created above. }