lua-users home
lua-l archive

Re: lpack question

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


The problems of not proof-reading an email before sending it...
>
> My lua code to read this follows:
> ,----[ lua code ]-
> | block = f:read(4)
> | local mopt = tonumber(string.byte(block))
> | print(string.format('type(MOPT) = %04d', mopt))
> | print(string.format('type(MOPT_unpack) = %04d', mopt_unpack))
I used the wrong cut and paste here: there ought to be another line
prior to the print lines:
 local mopt_unpack = string.unpack('l',block)
>
> My output follows:
> ,----[ output ]-
> | type(MOPT) = 0000
> | type(MOPT_unpack) = 0001
> | mrows = 1
> | ncols = 1
> | imagf = 0
> | namelen = 4
> | variable name is kap
> | value is 1
> `----
As an aside, I'm expecting MOPT to be 0000, not 0001. value ought to be 15.
I can write a valid MAT file going the other way using 'd' as a write
formatter; but it doesn't seem to play nice reading.
-- 
Keith ~~~~ pimmel@ieee.org

AltStyle によって変換されたページ (->オリジナル) /