lua-users home
lua-l archive

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


Hi Benoit,

>> Sure you can. Your table serialisation code just needs to grab all the keys, sort them, and then write the tables out in sorted order.

> Yes indeed, I think I'll do that first thing tomorrow morning :). Thanks (and to Sean as well) for the tip.

Some serializers support sorting of table keys; for example Serpent
provides alphanumeric sorting and allows users to specify a custom
sort function: https://github.com/pkulchenko/serpent#sorting. One of
the reasons to implement this (and to remove address-related data) was
to make the output diff-friendly. There was a lengthy discussion of
natural sort order on the maillist; I captured several implementations
and their results here:
http://notebook.kulchenko.com/algorithms/alphanumeric-natural-sorting-for-humans-in-lua.

Paul.

On Tue, Jul 29, 2014 at 11:42 AM, Benoit Germain <bnt.germain@gmail.com> wrote:
>
>
>
> 2014-07-29 17:17 GMT+02:00 Owen Shepherd <owen.shepherd@e43.eu>:
>>
>> Sure you can. Your table serialisation code just needs to grab all the
>> keys, sort them, and then write the tables out in sorted order.
>>
>> What's difficult about that?
>
> Yes indeed, I think I'll do that first thing tomorrow morning :). Thanks
> (and to Sean as well) for the tip.
>
>
> --
> Benoit.