lua-users home
lua-l archive

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


2009/5/27 可可熊 <cocobear.cn@gmail.com>:
> 2009/5/27 Jerome Vuarand <jerome.vuarand@gmail.com>:
>> I'm proud to announce the public release of Lunary, a deserialization
>> library. It is available on its website:
>>
>>    http://lunary.luaforge.net/
>>    http://piratery.net/lunary/ (mirror)
>>
>> Here is a little introduction:
>>
>>  Lunary is a framework to read and write structured binary data from
>>  and to files or network connections. The aim is to provide an easy to
>>  use interface to describe any complex binary format, and allow
>>  translation to Lua data structures. The focus is placed upon the
>>  binary side of the transformation, and further processing may be
>>  necessary to obtain the desired Lua structures. On the other hand
>>  Lunary should allow reading and writing of any binary format, and
>>  bring all the information available to the Lua side.
>>
>> Everything else, including download links, is explained on the website.
>> To compare it to existing struct libraries, that one is intended to be
>> higher level (actually I use an existing struct library for some low
>> level serialization). It can be used to load complex binary files
>> several tens or hundreds of megabytes long in a single operation without
>> problem.
>>
>
> Like struct pack in Python?

The existing Lua struct libraries [1][2][3] are very similar to the
Python one [4]. My library however takes a higher level approach where
you define named data types, and can combine them in complex manners.
While struct libraries are perfectly fine to describe C structures
containing only POD value, they are not capable of describing complex
file formats or network packets. This is where Lunary shines.

[1] http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lpack
[2] http://www.inf.puc-rio.br/~roberto/struct/
[3] http://lua-users.org/lists/lua-l/2009-02/msg00482.html
[4] http://docs.python.org/library/struct.html