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

Function lpb_pushfield

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

Source from the content-addressed store, hash-verified

1235}
1236
1237static int lpb_pushfield(lua_State *L, const pb_Type *t, const pb_Field *f) {
1238 if (f == NULL) return 0;
1239 lua_pushstring(L, (const char*)f->name);
1240 lua_pushinteger(L, f->number);
1241 lua_pushstring(L, f->type ?
1242 (const char*)f->type->name :
1243 pb_typename(f->type_id, "<unknown>"));
1244 lua_pushstring(L, (const char*)f->default_value);
1245 lua_pushstring(L, f->repeated ?
1246 (f->packed ? "packed" : "repeated") :
1247 "optional");
1248 if (f->oneof_idx > 0) {
1249 lua_pushstring(L, (const char*)pb_oneofname(t, f->oneof_idx));
1250 lua_pushinteger(L, f->oneof_idx-1);
1251 return 7;
1252 }
1253 return 5;
1254}
1255
1256static int Lpb_typesiter(lua_State *L) {
1257 lpb_State *LS = lpb_lstate(L);

Callers 2

Lpb_fieldsiterFunction · 0.85
Lpb_fieldFunction · 0.85

Calls 4

lua_pushstringFunction · 0.85
lua_pushintegerFunction · 0.85
pb_typenameFunction · 0.85
pb_oneofnameFunction · 0.85

Tested by

no test coverage detected