[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Preserving Table Order
- From: "Joshua Jensen" <jjensen@...>
- Date: Fri, 28 Dec 2001 11:32:18 -0700
> I'm intrigued to see that other people have faced this issue.
Only occasionally... Most times, I can find a work around. The only
time I care to preserve ordering much anymore is for serializing the
data back to disk in text form and maintaining the original order (which
is impossible to do in most cases).
> > function table_add(table, key, value)
> > table[getn(table) + 1] = key
> > table[key] = value
> > end
>
> Of course, that only works if the table does not have numeric
> keys, and if you never use table_add when you meant to just
> set an existing key, or vice versa.
Yeah, it was meant more for illustration (and coded off the top of my
head).
Your sample is more complete and will hopefully provide the original
asker more useful information.
-Josh