Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protoc:load问题 #34

Closed
yiyucyp opened this issue Feb 24, 2018 · 4 comments
Closed

protoc:load问题 #34

yiyucyp opened this issue Feb 24, 2018 · 4 comments

Comments

@yiyucyp
Copy link

yiyucyp commented Feb 24, 2018

for i, v in pairs(filelist) do
local out = loader(v)
if out then
local bb = protoc:load(out.text)
if bb == true then
print("ok")
else
print("failed")
end
--print(out.text)
end
end
只能把第一个文件给加载,后续的文件就不行,换了文件顺序发现,就是第一个成功

@starwing
Copy link
Owner

有错误嘛?我这边用protoc:load没啥问题,另外实际使用的时候还是推荐Protoc.new()然后load,比较灵活和安全,protoc:load主要是为了方便使用,会导致载入的proto的数据在内存中一直存在不会被消除

@yiyucyp
Copy link
Author

yiyucyp commented Feb 27, 2018

你试试下面的格式,会报错
`syntax = "proto3";
package protocol;

message get_ping {
}

message get_ping_ret {
}

enum register_result {
enumZero = 0;
registerSuccess = 1; //注册成功
userExists = 2; //用户名已经存在
invalidFormat = 3; //用户名格式不符合规范
invalidServer = 6; //连接游戏服务器失败
}

//登录服务器注册账号
message login_register{
string username = 1; //用户名
string password = 2; //密码
}

//登录服务器注册账号返回
message login_register_ret {
register_result result = 1; //注册结果
int32 uid = 2; //用户id 注册成功返回此字段
string token = 3; //登录令牌 注册成功返回此字段
string gameServer = 4; //返回游戏服务器地址
string msg = 5; //反馈消息 登录失败返回
}

message C2S {
int32 seq = 1; //消息序号
int32 msgType = 2; //消息ID
//-----------------通用接口---------------
get_ping get_ping = 3;

//-----------------登录模块接口---------------
login_register login_register = 6;

}

message S2C {
int32 seq = 1;
int32 msgType = 2; //消息ID
//-----------------通用接口---------------
get_ping_ret get_ping_ret = 3;

//-----------------登录服接口---------------
login_register_ret login_register_ret = 6;

}

//rpc 服务间转发
service RPCService {
rpc request(C2S) returns(S2C);
}`

@starwing
Copy link
Owner

starwing commented Mar 4, 2018

现在应该好了?

@starwing
Copy link
Owner

starwing commented Mar 8, 2018

没有后续反馈了,暂时关掉,如果还有问题可以再打开~

@starwing starwing closed this as completed Mar 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants