Transports the google protocol buffer in NPL
- Install python 2.7.0
- Install tools/setuptools-0.6c11.win32-py2.7.exe
- Add system variable path for python.exe
- Add system variable path for protoc.exe
- Download protobuf-2.4.1 and unzip
cd protobuf-2.4.1/python
python setup.py install
buildProto.bat
-- add search path
ParaIO.AddSearchPath("npl_packages/ProtocolBuff/npl_mod/ProtocolBuff");
-- activated pb state
NPL.call("protocol/pb.cpp", {});
local person_pb = NPL.load("samples/person_pb.lua");
local msg = person_pb.Person()
msg.id = 100
msg.name = "foo"
msg.email = "bar"
local pb_data = msg:SerializeToString()
-- Parse Example
local msg = person_pb.Person()
msg:ParseFromString(pb_data)
echo({msg.id, msg.name, msg.email})