[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Standard data buffer?
- From: Mark Hamburg <mhamburg@...>
- Date: Sun, 12 Sep 2004 11:12:08 -0700
Are there any standard data buffer APIs (or implementations) for Lua? I'm
thinking about something much like strings but editable and not interned.
For example, if I'm reading a JPEG, turning the bytes into a string seems
like excessive work for the code to go through. Actually, there are a lot of
cases where this might be useful such as text file processing if the string
pattern match facilities were made to work on data buffers.
I can certainly implement something like this, but I'd favor a standard
API/implementation if one existed.
(On a related note, this is a place where it would be useful to store links
between userdata items. That would allow one to create subranges of data
buffers that would look like regular data buffers. The subrange objects,
however, would need to reference their parent buffers. That can be done
using weak tables, but it will slow collection of the base buffers since I
think it will take multiple passes to determine that they are unreachable.)