[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Standard data buffer?
- From: Philippe Lhoste <PhiLho@...>
- Date: Mon, 13 Sep 2004 13:45:12 +0200
Mark Hamburg wrote:
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.
This looks like the string buffer I wished to have not so long ago...
Of course, by "string", I mean data, ie. it can store whatever bytes you
want to put there.
Such a string buffer should allow to read a range of bytes, apply all
Lua string operations on a range, add data to the current end of the
buffer (or at any position, overwriting or inserting), with definable
behavior in case of overflow: either truncate written data, perhaps with
a kind of exception rising, or growth the buffer to fit the additional
data and more. Etc.
I really should work on it, unless somebody has done it (Tiago's
lustring?) or write it before me...
-- (near) Paris -- France
-- Professional programmer and amateur artist
-- -- -- -- -- -- -- -- -- -- -- --