lua-users home
lua-l archive

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

Luis Carvalho <> wrote:

> [about his pickler]

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.

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?

cheers  thomasl

web :