lua-users home
lua-l archive

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

On Sun, Nov 17, 2013 at 10:32 AM, Marc Balmer <> wrote:
> Hi
> How do you deal with I/O of binary data?  Do you use the standard io
> functions somehow or did you write your own bindings?
> As strings are 8-bit clean and can contain embedded zeroes, I have the
> feeling that they can be well used for binary data.
> Any thoughts, experiences, etc.?

You can use strings, although there is not usually much point
interning binary data, so it is just an overhead.

As Steve says, a struct-like library is useful if your binary parsing
is struct-like, it depends what it is though if its compressed or
images its going to be a bit different. I don't think there is a
generic case, "binary" is a broad church. I would start with the
parsing structure, work out what a nice API for that is and work from