I have a proto file in directory proto/:
proto/order.proto
I want to use this proto file.
how can I do this?
Could someone give me a full, working and self-contained example how to do this?
local pb = require "pb"
local pbio = require "pb.io"
local protoc = require "protoc"
pbio.dump("abc.proto", [[
syntax = "proto3";
package abc;
message Msg {
int32 id = 1;
}]])
assert(protoc.new():loadfile("abc.proto"))
local data = {
id = 0
}
local chunk, other_result = pb.encode("Msg", data)
result:
% lua test.lua
lua: test.lua:20: bad argument #1 to 'encode' (type 'Msg' does not exists)
stack traceback:
[C]: in function 'pb.encode'
test.lua:20: in main chunk
[C]: in ?
I have a proto file in directory proto/: proto/order.proto
I want to use this proto file.
how can I do this?
Could someone give me a full, working and self-contained example how to do this?
result:
what am I doing wrong?