a lua google flatbuffers encode/decode module base on google flatbuffers reflection
See more about google flatbuffers at http://google.github.io/flatbuffers/
- gcc >= c++17
- lua >=5.3.0(http://www.lua.org/)
- FlatBuffers >=1.11.0(https://github.com/google/flatbuffers/releases)
make sure flatbuffers shared library is built if you need to build the lua_flatbuffers.so.
Make sure lua and FlatBuffers develop environment already installed
- git clone https://github.com/changnet/lua_flatbuffers.git
- cd lua_flatbuffers
- make buildfbb(this will install FlatBuffers with shared library)
- make
- make test
- copy lua_flatbuffers.so to your lua project's c module directory or link against liblua_flatbuffers.a
-- encode lua table into flatbuffer and return the buffer
encode( bfbs,object,tbl )
-- decode flatbuffer into a lua table,return the lua table
decode( bfbs,object,buffer )
-- load all the flatbuffers binary schema file in path with suffix
load_bfbs_path( path,suffix )
-- load one binary schema file
load_bfbs_file( path )
See 'test.lua'
Travis-ci test 100000 times,encode elapsed time: 1.14 second,decode elapsed time: 2.36 second
- namespace not supported! you have to put objects with same name in different schema file,though they are in different namespace.
- deprecated field still be encode or decode.
- [byte] or [ubyte] will be encode as lua string
See document