Protobuf-Lua 中使用 Enum
2015-12-12 02:16
756 查看
--Student.proto message Course { required int32 id=1; required int32 name=2; required SomeEnum bar=3; } enum SomeEnum { VALUE_A=0; VALUE_B=5; VALUE_C=1234; }
测试代码
StudentTest.lua
package.path = package.path .. ';./protobuf/?.lua;./protobuf/luascript/?.lua'
require("Student_pb")
local msgCourse=Student_pb.Course()
msgCourse.bar=Student_pb.VALUE_A
print(msgCourse.bar)
msgCourse.bar=Student_pb.VALUE_B
print(msgCourse.bar)
msgCourse.bar=Student_pb.VALUE_C
print(msgCourse.bar)
输出
0 5 1234 [Finished in 0.1s]
相关文章推荐
- protoc-gen-lua extensions正确的使用方式
- [stack]Evaluate Reverse Polish Notation
- lua 中pairs 和 ipairs区别
- lua学习06——lua中的面向对象
- PB中的Describe,Evaluatate,LookUpDisplay小结
- lua读取xml
- lua——userdata使用
- lua学习05——库s
- Learning Game AI Programming with lua(一)
- Lua中的基本函数库
- LUA脚本在游戏中的应用场合
- lua使用总结
- leetcode Evaluate Reverse Polish Notation
- Ubuntu编译Lua
- lua 链表 迭代器
- Luajit反编译之探索记
- lua 5.2 GC 源码分析 一
- 使用luabind生成dll文件
- iOS使用lua语言的使用步骤与实现插件的动态更新
- Assembly x64 Intro - Horner Polynomial Evaluation