lua-users home
lua-l archive

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


On Mon, Oct 27, 2014 at 5:34 AM, Alexandre (gaumerie)
<gaumerie@hotmail.com> wrote:
>
> It could be an interesting addition to have a capture system in the struct pack/unpack functions, similar to captures in the pattern matching functions.
> If one wants to read a C structure, but only needs some values from the structure. Sure, you can:
>   - read all the data structure and get the values you need from the return values, but so you have to deal with potentially a lot of return values or create a temporary table.
>   - look for the offset of the values you want to read, and read one by one, but it is more work and you have to deal with data size and alignement in computing the offset.
> And it is clean.
> Actually I don't see a need for that from my side now, but it seems easy to implement (at first sight, I am not a professional of programming and have not tried), fits naturally with the mechanism and it is easy to find some applications.
> What do you think about this?

You could take a look at Luadata [1]; maybe it fits on your needs.

[1] github.com/lneto/luadata

Regards,
--
Lourival Vieira Neto