[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: An operator syntax for bitfields using metatables
- From: Thomas Buergel <Thomas.Buergel@...>
- Date: Tue, 16 Jul 2013 08:55:37 +0000
Diverging from the original topic a bit...
Robert wrote:
> While operators for bit-fields are very useful I think a
> better way is a syntax which allows you describe/build
> the whole bitstring in one go. We have this in Erlang and
> it makes building/pulling apart protocol packets very
> much easier and clearer.
...
> This really is powerful and simplifies a lot of things
> and I think that something similar would be useful for Lua
> if you seriously intend to work with bitfields.
I agree - something like vstruct [1, 2] could do the job. I have used it for just that, packing/unpacking network protocols.
Tom
[1] https://github.com/ToxicFrog/vstruct
[2] http://lua-users.org/lists/lua-l/2013-01/msg00433.html