lua-users home
lua-l archive

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


Well i'd say write a string.word() function, so you can then write:

Word = string.word(Filehandle:read(2))

You might also consider read the whole file into a string and then
processing that string

Cheers,
Peter

> -----Original Message-----
> From: owner-lua-l@tecgraf.puc-rio.br
> [mailto:owner-lua-l@tecgraf.puc-rio.br]On Behalf Of Markus Huber
> Sent: Friday, January 17, 2003 2:52 AM
> To: Multiple recipients of list
> Subject: enhance fh:read?
>
>
> Is it possible to enhance fh:read() in Lua-Code itself?
>
> Now I use this:
>
> Word= string.byte(Filehandle:read(1))*256
>      +string.byte(Filehandle:read(1))
>
> But I would prefer this way:
>
> Word=Filehandle:read('w')
>
> (Please no discussion about Word 16 or 32 bit ;-)
>
> Thanks
>
>
> Markus