MessagePack for Serialization


I am trying to use MessagePack (MessagePack: It's like JSON. but fast and small.) for serialization rather than json

I am using Lua & Unity. Any one had experience using MessagePack with Lua ? and do you recommend using it.

@Mohammed What MessagePack library do you want to use with Lua? The official one linked on the MessagePack website appears to be broken now.

Why do you want to use MessagePack? Do you have a specific game protocol you still want to create?

I had some issues with TinyJson (Nakama.TinyJson Parsing High Numbers Problem)
So I was reading about methods to serialize data and MessagePack had a lot of benefits like speed, performance & data size
So I checked it

There are two options for Lua on the site
I tried

but I had some issues on line 148

local length = #elements // 2

Also tried the below link and encountered some problems

I know this is not an issue related directly to Nakama but I though maybe someone used it and can share his knowledge. Also, maybe a good solution to be considered along with TinyJson.


its for Lua 5.3 & Nakama uses 5.1 that’s way // floor division is not recognized & string.pack & so on

Hey @novabyte

My question may seem naive, but is it difficult to upgrade Nakama to LUA 5.3 so we get more features with LUA.

Upgrading to Lua 5.3 would not be trivial, and is not part of the immediate roadmap.

If you absolutely must use a feature that’s not possible with Lua 5.1 then the Go runtime might be worth considering instead - it would allow you to use any Go library or package you care to import.

1 Like