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

Function Lbuf_pack

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

Source from the content-addressed store, hash-verified

818}
819
820static int Lbuf_pack(lua_State *L) {
821 pb_Buffer b, *pb = test_buffer(L, 1);
822 int idx = 1 + (pb != NULL);
823 const char *fmt = luaL_checkstring(L, idx++);
824 if (pb == NULL) pb_initbuffer(pb = &b);
825 lpb_packfmt(L, idx, pb, &fmt, 0);
826 if (pb != &b)
827 lua_settop(L, 1);
828 else {
829 pb_Slice ret = pb_result(pb);
830 push_slice(L, ret);
831 pb_resetbuffer(pb);
832 }
833 return 1;
834}
835
836LUALIB_API int luaopen_pb_buffer(lua_State *L) {
837 luaL_Reg libs[] = {

Callers

nothing calls this directly

Calls 5

pb_initbufferFunction · 0.85
lpb_packfmtFunction · 0.85
lua_settopFunction · 0.85
pb_resultFunction · 0.85
pb_resetbufferFunction · 0.85

Tested by

no test coverage detected