Lua Protobuf (libraries from luarocks)

Hello!
Im trying to using protobuf in my game and founded some libraries to do it ( https://github.com/Neopallium/lua-pb, https://github.com/djungelorm/protobuf-lua). There is way to install it and using in my game?
Seems need to use luarocks package manager. Can i do it and how? (windows)

LuaRocks is a conventient way to download a Lua library and it’s dependencies. It can be done by hand as well.

In order to include Lua libraries you need to have them accessible from the root folder or a subfolder of your project. You cannot load modules from other sources (well, maybe using loadfile, but that won’t be cross platform).

You can only use pure Lua libraries. Many Lua libraries include a C lib as well. This seems to be the case with the second protobuf library. The first one (lua-pb) should be fine though.

Summary: Download the library source code and any dependencies and put the files in your project. Lua modules can then be included and used in your scripts using the require() function.

Thanks for answer! I will try more but there is a problem:
A lot of libraries what I found, depends of some libraries on C language, so, as i am undestand, i can’t use them?
lua-pb depends from the c-lib, as I know now.

edit: ok. i cannot use any of these pb libraries (dependecies :(). What I can do to work with protobufs in defold?

And in this forum post: Defold 1.2.81 has been released
There is line: DEF-1353 - Fixed: GUI protobuf message docs are not included in API docs. What is means? :slight_smile:

The doc update included messages for GUI components: http://www.defold.com/ref/gui/#layout_changed:id-previous_id

The engine uses protobuf internally.

1 Like

So, is it possible to give to users protobuf api?
Just because I cant see another way to use protobuf in Defold.

It should be possible to create a pure Lua implementation of protobufs. I’m surprised there is none available.

Could I ask why you have chosen to use protobufs?

Pure lua protobuf will be not so fast as needed (the main protobuf advantage), isn’t? Rly dont know about lua speed in this things.

I have choosed pb, because i wanted to work with it and learn it. And pb advantages is very good (speed and size) for network shooter game.

Should I edit this theme to “Feature request?”

LuaJIT which we use in Defold is very fast. Is it fast enough? Probably, but I do not know for sure. What’s the estimated amount of data sent and received every frame? You need to do some benchmarking yourself (and with help from the community here perhaps).