Skip to content

Conversation

grafi-tt
Copy link
Owner

@grafi-tt grafi-tt commented Jan 4, 2019

preserveorder option added to decoder, using a custom ordered table implementation similar to http://lua-users.org/wiki/OrderedTable (Last edited June 23, 2015 8:15 am GMT). This implementation relies on __pairs metamethod. Encoder is modified to patch old pairs function.

While I think using __pairs metamethod is the cleanest way, I'm not yet decided. As suggested on #4, saving the order with integer indices is also possible. obj[0] could be -1 for distinction to arrays. It is somewhat consistent with arraylen option, which uses array[0] instead of __len metamethod.

@tst2005 tst2005 mentioned this pull request Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant