lua-users home
lua-l archive

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

----- Henk Boom <> wrote:
> On 11 April 2010 19:43,  <> wrote:
> > I'm reading some files in an existing binary format, which include 
> > 4-byte floating-point numbers. I have the file's contents loaded
> > into a string. I need a function which will parse one floating-point 
> > number from the string, given the index of the first byte. Does Lua's 
> > library provide this? Or should I throw something together with the 
> > bitop library?
> >
> > This is using Lua 5.1.4.
> I faced this problem a while ago when trying to decode some doubles in
> OSC. It was pretty surprising to hit such a brick wall, I'm thinking
> the easiest way would be either bitops or a proper pointer cast in C.
>     henk
Well, since this Lua code is going to be a plugin for an existing C
application, it shouldn't be too hard to do this specific function in 
C if I really need to. I just hoped to avoid it. 

(By the way, sorry about that long line, I thought my mail client would
wrap automatically. I think I fixed it.)