starwing / lua-protobuf

A Lua module to work with Google protobuf
MIT License
1.73k stars 387 forks source link

[feature request] allow custom encoding of buildin types #212

Open StarlightIbuki opened 2 years ago

StarlightIbuki commented 2 years ago

It would be helpful to allow this:

pb.custom_encode('bool', function (v) 
  return v and not v == "false"
end

(I'm not sure if hook does what this does so I wrote custom_encode, and currently pb refuses to hook build-in types)