MCPcopy Create free account
hub / github.com/Tencent/UnLua / Lpb_clear

Function Lpb_clear

Plugins/UnLuaExtensions/LuaProtobuf/Source/src/pb.cpp:1447–1468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1445}
1446
1447static int Lpb_clear(lua_State *L) {
1448 lpb_State *LS = lpb_lstate(L);
1449 pb_State *S = (pb_State*)LS->state;
1450 pb_Type *t;
1451 if (lua_isnoneornil(L, 1)) {
1452 pb_free(&LS->local), pb_init(&LS->local);
1453 luaL_unref(L, LUA_REGISTRYINDEX, LS->defs_index);
1454 LS->defs_index = LUA_NOREF;
1455 luaL_unref(L, LUA_REGISTRYINDEX, LS->enc_hooks_index);
1456 LS->enc_hooks_index = LUA_NOREF;
1457 luaL_unref(L, LUA_REGISTRYINDEX, LS->dec_hooks_index);
1458 LS->dec_hooks_index = LUA_NOREF;
1459 return 0;
1460 }
1461 LS->state = &LS->local;
1462 t = (pb_Type*)lpb_type(LS, lpb_checkslice(L, 1));
1463 if (lua_isnoneornil(L, 2)) pb_deltype(&LS->local, t);
1464 else pb_delfield(&LS->local, t, (pb_Field*)lpb_field(L, 2, t));
1465 LS->state = S;
1466 lpb_cleardefmeta(L, LS, t);
1467 return 0;
1468}
1469
1470static int Lpb_typefmt(lua_State *L) {
1471 pb_Slice s = lpb_checkslice(L, 1);

Callers

nothing calls this directly

Calls 10

lpb_lstateFunction · 0.85
pb_freeFunction · 0.85
pb_initFunction · 0.85
luaL_unrefFunction · 0.85
lpb_typeFunction · 0.85
lpb_checksliceFunction · 0.85
pb_deltypeFunction · 0.85
pb_delfieldFunction · 0.85
lpb_fieldFunction · 0.85
lpb_cleardefmetaFunction · 0.85

Tested by

no test coverage detected