Open rom1504 opened 8 years ago
Concerning padding, I'm thinking of adding a min/max datatype. Something like ["min", 64, ["container", []]
or ["max", 64, ["container", []]
. This is for replacing the current garantee that we know the datatype size in NMP. With the same datatype, we could add a padding value so that if it doesn't reach that value, it adds that padding until it does.
handling "count":64 is indeed useful. (need it for node-raknet) I think I'll add that soon
can't see how that would eliminate countType.
countType means "add the length before the array", count doesn't do that
The idea is that in places where we can accept both a static number or a protocol-defined number (or anything else for that matter), we should have a standardized way to do it. A "selector".
count: 64
count: "$var"
count: "@type"
This pattern comes up quite often in datatypes (array, the fixed data-type I talk about in #57, a few other datatypes I wrote myself in other projects) so having a standardized way to do it with tools to easily operate with that would be good.
Ah, this would allow compareTo:"value".
useful for https://github.com/mhsjlw/minecraft-classic-protocol/blob/master/src/datatypes/minecraft.js http://wiki.vg/Classic_Protocol#Protocol_Data_Types
(+ what about padding ?)