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

Function Lpb_encode_hook

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

Source from the content-addressed store, hash-verified

1428}
1429
1430static 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
1447static int Lpb_clear(lua_State *L) {
1448 lpb_State *LS = lpb_lstate(L);

Callers

nothing calls this directly

Calls 11

lpb_lstateFunction · 0.85
lpb_typeFunction · 0.85
lpb_checksliceFunction · 0.85
lua_typeFunction · 0.85
luaL_argerrorFunction · 0.85
typeerrorFunction · 0.85
lua_settopFunction · 0.85
lpb_pushenchooktableFunction · 0.85
lua_pushvalueFunction · 0.85
lua_rawgetpFunction · 0.70
lua_rawsetpFunction · 0.70

Tested by

no test coverage detected