lua-users home
lua-l archive

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


>From: Steve Dekorte <steve@dekorte.com>
>
>erik@hougaard.com (Erik Hougaard) wrote:
>> What kind of memory buffers? ... I'm using tons O' buffers via the
>> userdata data type (and the tag system)
>
>lhf@tecgraf.puc-rio.br wrote:
>> also, remember that strings in lua 3.1 can contain arbitrary data, including
>> embbeded zeros, and so are better described as byte arrays or memory buffers.
>
>I need to read binary files and then read, manipulate and save parts of it.
>I can do this with strings?

yes.

>Currently, when I write a string to a file
>using Lua the resulting file is ASCII, not binary.

what do you mean, "ASCII, not binary"?
this works:

	a= "lua\000is\001\great\007"
	write(a)

gives this file (hex dump below):

00000000  6c 75 61 00 69 73 01 67 - 72 65 61 74 07           lua.is.great.

--lhf