The order of elements when traversing the table (pairs) in lua is unpredictable. In OrderedTable, the traversal order always corresponds to the order in which keys are added.
localtbl=OrderedTable()
tbl.a=5tbl.b=6tbl.c=8tbl.d=9print(#tbl) --> 4fork, vinpairs(tbl) doprint(k,v) end--> a 5, b 6, c 8, d 9tbl.b=nilprint(#tbl) --> 3fork, vinpairs(tbl) doprint(k,v) end--> a 5, c 8, d 9localtbl_2=OrderedTable()
print(getmetatable(tbl) ==getmetatable(tbl_2)) --> true