lua-users home
lua-l archive

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


----- Original Message -----
From: Fabio Mascarenhas
Date: 9/4/2008 1:16 PM
Alas, using struct.unpack is a temporary bandaid while I do not
implement an struct abstraction on top of the buffers (like array).
The support for figuring out offsets from a description of the struct
is already in core.c, in the form of alien.sizeof and alien.align, so
it can be implemented as a Lua addon (just like arrays).
Although not complete enough for my needs, I liked the approach CInvoke's Lua module took for structure definition. Ultimately, I think struct.unpack will still be needed for special cases, but your struct abstraction will work most of the time. (It occurs to me now that CInvoke didn't handle structures with arrays like 'char name[256]'.)

Josh