Closed git-torrent closed 5 months ago
Have you tried the latest lua-protobuf? it works for me:
local protoc = require "protoc" -- protocol buffer compiler, similar to `pb` standing for `protocol buffers`
local p = protoc.new();
-- p.include_imports = true;
p:addpath( "" );
p:loadfile( "a/x.proto" );
print ( "loaded" );
produces:
$ lua -- test.lua
loaded
Thank you, lua-protobuf-0.5.1-1 works perfectly
I have three files (in attachment) proto.zip
The example is for Windows (my workstation), but the same happens on Linux. Running the test.lua causes error:
Exception has occurred: ../Program Files (x86)/Lua/5.1/lua/protoc.lua:82: c:\proto\a\x.proto:13:3: unknown type 'b.Z
The same with
protoc --cpp_out=. -I c:\proto c:\proto\a\x.proto
does everything without any complaint.According to https://protobuf.dev/programming-guides/proto3/#name-resolution the names should be resolved inside out. This seem to fail in protoc-lua. If I change the attribute to use definition fully qualified name, it works.
We do not use fully qualified names because of zero added value (visual noise) if the common part is enough for google tooling.
In lua protoc, is this a bug or a feature? Can it be fixed to behave according to spec?
Thank you