2.解压protobuf-23.1.zip文件,找到python目录,并在protobuf中的python目录打开cmd将下面三条命令敲入 (pip的protobuf和下载的protobuf版本最好一致)–要在当前目录下的cmd噢 pip install protobuf python setup.py build python setup.py install ### 安装命令会将当前
我了解过的过去的状况,protoc-gen-lua使用起来其实更加简单一些,要装python的protobuf库,pbc额外去做了一个protobuf的c语言实现,然后在这个基础上实现了lua bind,两者都不支持最新的lua和protobuf版本,看了github问题列表,最后还有不少问题,大多是proto文件的语法解析,这个其实很复杂的,pbc已经不维护了。另外编译出的...
Protobuf有着出色的性能、优秀的版本兼容性并且支持当下大部分的主流语言,在各种网络通信场景中被广泛使用。Lua作为一种效率极高的脚本语言,它可以方便得被嵌入到C程序中,并且支持热更新代码,在游戏行业不管是客户端还是服务器都很受欢迎。所以我想在Lua中使用Protobuf这个需求应该“合情合理”。但是,我在Protobuf中...
可以用git从服务器上(https://github.com/google/protobuf)下载最新的protobuf。 进入protobuf-2.4.1/vsprojects利用VS2010进行编译。生成的protoc.exe放到protobuf-2.4.1/src下。如果不放,后面无法安装python版的protobuf。 4、编译python版本的protobuf 在protobuf-2.4.1\python下运行python setup.py build,然后...
关于protobuf的历史及其特点,可参考Google网站:点击打开链接 二、语法规则 protobuf协议的文件后缀名为.proto。一个简单的protobuf协议如下: message Person { required string name = 1; required int32 id = 2; optional string email = 3; enum PhoneType { ...
Protobuf 官方并没有 Lua版本,然后网易的程序猿开发出了 protoc-gen-lua ,可以让我们将 Proto 文件转成 lua 脚本在 Lua中使用,下面是详细的编译、安装、使用教程。文中用到的代码、工具都有百度网盘下载。 网盘下载地址: http://pan.baidu.com/s/1bo8Ufd9 ...
def code_gen_enum_item(index, enum_value, env): full_name = env.get_local_name() + '.' + enum_value.name obj_name = full_name.upper().replace('.', '_') + '_ENUM' env.descriptor.append( "local %s = protobuf.EnumValueDescriptor();\n"% obj_name ...
//protobuf定义// NCmdIdenumNCmdId{ NID_QUANTA_ZERO =0; NID_HEARTBEAT_REQ =1001; NID_HEARTBEAT_RES =1002; }messagechild_message{uint32id =1;// idstringname =2;// namemap<string,string> values =3; }messagetest_message{uint32id =1;// idchild_message child =2;repeatedint32custom2...
Protobuf TypesLua Types double,floatnumber int32,uint32,fixed32,sfixed32,sint32numberorintegerin Lua 5.3+ int64,uint64,fixed64,sfixed64,sint64numberor"#"prefixedstringorintegerin Lua 5.3+ boolboolean string,bytesstring messagetable enumstringornumber ...
Lua Protobuf interface. Binding Protobuf to Lua with lua-intf, supporting lua53 and proto3. LuaPbIntf is inspired byluapb, but has been rewritten to take advantage oflua-intf, which makes the binding easier to use and easier to understand. ...