lua-users home
lua-l archive

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


> Funny, I was just at the point of writing exactly that sort of thing,
> though based on my own, more Perl-oriented pack/unpack code.

Well, it kinda asks for it, isn't it? :)

> One quick remark after skimming the code. In pickle() I see this:
> 
> >   elseif t == "string" then
> >     return pack("BBc0", TSTRING, #o, o)
> 
> and further down this:
> 
> >   elseif t == "function" then
> >     local f = dump(o)
> >     return pack("BBc0", TFUNCTION, #f, f)
> 
> If I understand the documentation for Roberto's struct library
> correctly, "BBc0" won't allow strings or functions longer than 255
> bytes. Shouldn't the pack code be "BHc0" (max. 65535) or even "BLc0"?
> (Of course, unpickle() would have to change accordingly.)
> 
> Or am I missing the obvious?

No, I missed the obvious. You are right. I just took this code from one of
Roberto's examples while I was playing with struct and forgot to adapt it
later. Thanks!

Cheers,
Luis.

-- 
A mathematician is a device for turning coffee into theorems.
        -- P. Erdos 

-- 
Luis Carvalho
Applied Math PhD Student - Brown University
PGP Key: E820854A <carvalho@dam.brown.edu>