Replies: 2 comments 3 replies
|
i like this library, but bitser is uhm... not a dutch word. at least, ive never heard it in my many years in holland |
1 reply
|
I'm a little late to the party, but I would like to get some tutorials regarding class registration. Here is my idea: --#region Packet types
---Every type of packet.
---@class PKT_TYPE
PKT_TYPE = {
CONNECT = {
REQUEST = 11,
ACCEPT = 12,
},
}
-- templates of how different packets would look
PKT_TEMPLATE = {}
PKT_TEMPLATE.CLIENT = {
"type",
"clientID",
data = {},
}
PKT_TEMPLATE.SERVER = {
"type",
data = {},
}
--#endregion
-- Then it'd be great if I could "register" these tables
bitser.register("ClientBasePacket", PKT_TEMPLATE.CLIENT)
-- then, creating a packet from a client
function createClientPacket(type, data)
local pkt = {
type = type,
data = data or nil,
}
local serialised = biter.dumpclass("ClientBasePacket", pkt)
return serialised
endThis obviously doesn't work right now, but it's how I think should work. I don't have any documentation to check for how to do it, and bitser changes a few things from binser, and even binser's documentation is sparse or just wrong. I could also explore the idea of static byte lengths for the payload's headers, but I haven't gotten explored that yet, for now. |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
👋 Welcome!
We’re using Discussions as a place to connect with other members of our community. We hope that you:
build together 💪.
To get started, comment below with an introduction of yourself and tell us about what you do with this community.
All reactions