lua-users home
lua-l archive

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


It was thus said that the Great bil til once stated:
> What is the element "result.message" in your code - is this a table with
> exactly 17 elements, so that you can write in lua 5.3 "result.message, pos=
> string.upack..."? (I assume in "pos" you want to get back the "index of
> first unread byte" in your source string "blob"?).

  And because you seem to ignore my hints about you actually implementing
your proposal, I'm answering this one in a separate email.

  The variable "result" is a table passed in to the decode routine, and the
call to string.unpack() unpacks the blob of data (also passed in) into
fields in that table.  The variable "result.message" is a string, containing
the string specified at the end of the format (it's "s1"---a string preceded
by its length coded as an unsigned integer of 1 byte).  There may be
optional data to parse past the fixed format.

  -spc