| 1445 | } |
| 1446 | |
| 1447 | static 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 | |
| 1470 | static int Lpb_typefmt(lua_State *L) { |
| 1471 | pb_Slice s = lpb_checkslice(L, 1); |
nothing calls this directly
no test coverage detected