lua-users home
lua-l archive

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

2011/10/18 Victor Young <>:
> For example, I have following codes:
> t = {
> x=1,
> y=2,
> a=3,
> b=4
> }

> If I want the output to be like follow:
> x       1
> y       2
> a       3
> b       4
> just in the order of how I construct the table, how could I do? Thanks!

After that `t={…}` the order of construction is gone.  No way to get
it back. There are several ways to do what you want, but all of them
rely on keeping the list {'x','y','a','b'} somewhere.