lua-users home
lua-l archive

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


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