Skip to content

Commit

Permalink
default values of proto3 (#272)
Browse files Browse the repository at this point in the history
the bool default value also can be skipped

Co-authored-by: zhoupy <[email protected]>
  • Loading branch information
findstr and zhoupy authored Nov 1, 2024
1 parent 9a6050e commit 018eecf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pb.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,10 @@ static size_t lpb_addtype(lua_State *L, pb_Buffer *b, int idx, int type, int *pe
size_t len = 0;
switch (type) {
case PB_Tbool:
len = pb_addvarint32(b, ret = lua_toboolean(L, idx));
v.u32 = lua_toboolean(L, idx);
len = pb_addvarint32(b, v.u32);
ret = 1;
if (v.u32 == 0) has_data = 0;
break;
case PB_Tdouble:
v.lnum = lua_tonumberx(L, idx, &ret);
Expand Down

0 comments on commit 018eecf

Please sign in to comment.