lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> Why string.pack does not support `c0` format?
> I  think  `s  =  string.pack("...c0c0c0",  ...,  s1,  s2, s3)` is more
> convenient than `s = string.pack("...", ...) .. s1 .. s2 .. s3`
> And I agree that for unpack this format does not make sense.

Actually it does, if it is the last option (get the rest of the subject).

There is no limit to the number of things we can add to pack and/or

- literal characters (already asked here) 
- get the rest of the subject (already asked here)
- strings with lengths encoded somewhere else (already asked here)
- assignment suppression (already asked here)
- configuration for the padding character (already asked here)
- repetitions (not yet asked here)
- all nice options offered by Perl :-)

All of them will make pack/unpack more convenient for some tasks. So,
unless you are proposing to add all these features, you should have a
very strong argument that your feature is much more important than the

-- Roberto