| 1428 | } |
| 1429 | |
| 1430 | static int Lpb_encode_hook(lua_State *L) { |
| 1431 | lpb_State *LS = lpb_lstate(L); |
| 1432 | const pb_Type *t = lpb_type(LS, lpb_checkslice(L, 1)); |
| 1433 | int type = lua_type(L, 2); |
| 1434 | if (t == NULL) luaL_argerror(L, 1, "type not found"); |
| 1435 | if (type != LUA_TNONE && type != LUA_TNIL && type != LUA_TFUNCTION) |
| 1436 | typeerror(L, 2, "function"); |
| 1437 | lua_settop(L, 2); |
| 1438 | lpb_pushenchooktable(L, LS); |
| 1439 | lua_rawgetp(L, 3, t); |
| 1440 | if (type != LUA_TNONE) { |
| 1441 | lua_pushvalue(L, 2); |
| 1442 | lua_rawsetp(L, 3, t); |
| 1443 | } |
| 1444 | return 1; |
| 1445 | } |
| 1446 | |
| 1447 | static int Lpb_clear(lua_State *L) { |
| 1448 | lpb_State *LS = lpb_lstate(L); |
nothing calls this directly
no test coverage detected