arr={}
for i=1,100 do
-- print(i)
table.insert( arr , 1, i )
end
In the above code, when table.insert in Lua adds data to the table, why does the array structure become {100,99,98,.. ....,3,2,1} instead of {1,2,3,4....99,100}
z_san2018-06-15 17:04:01
Solved. When table.insert adds data to the table, it inserts the first position every time. That is, the table structure for the first cycle is {1}, and the structure for the second cycle is {2,1}. Three times {3,2,1}..., and so on