lua-users home
lua-l archive

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


On Fri, 14 Oct 2011 09:21:01 +0800
Shaun savage <savages@mozapps.com> wrote:

> 
> I have looked at http://lua-users.org/wiki/StructurePacking
> Ihave tried vstruct ( works, but only read into a table(array), no
> dictionary)

This is untrue; vstruct can read into dictionaries and is primarily
meant to do so:

>> coords = vstruct.unpack(buf, "x:u4 y:u4 z:u4")
>> print("Coordinates:", coords.x, coords.y, coords.z)

Any field or subtable can be assigned a name. It's only the ones you
don't give names to that go into the array-part of the table.

> The documentation for vstruct could be much better, start with a very
> simple working example

In which ways do you think the documentation should be improved? Are
there parts that are unclear? Would you like more code examples?

	Ben Kelly