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

Function Lpb_pack

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

Source from the content-addressed store, hash-verified

1698}
1699
1700static int Lpb_pack(lua_State* L) {
1701 lpb_State* LS = lpb_lstate(L);
1702 const pb_Type* t = lpb_type(LS, lpb_checkslice(L, 1));
1703 lpb_Env e;
1704 int idx = 3;
1705 e.L = L, e.LS = LS, e.b = test_buffer(L, 2);
1706 if (e.b == NULL) {
1707 idx = 2;
1708 pb_resetbuffer(e.b = &LS->buffer);
1709 }
1710 lpbE_pack(&e, t, idx);
1711 if (e.b != &LS->buffer)
1712 lua_settop(L, 3);
1713 else {
1714 lua_pushlstring(L, pb_buffer(e.b), pb_bufflen(e.b));
1715 pb_resetbuffer(e.b);
1716 }
1717 return 1;
1718}
1719
1720/* protobuf decode */
1721

Callers

nothing calls this directly

Calls 7

lpb_lstateFunction · 0.85
lpb_typeFunction · 0.85
lpb_checksliceFunction · 0.85
pb_resetbufferFunction · 0.85
lpbE_packFunction · 0.85
lua_settopFunction · 0.85
lua_pushlstringFunction · 0.85

Tested by

no test coverage detected