Code: Select all
>> queue = {"do this", "do that", "do something else"}
>>send(table.pop( queue))
do this
>> for i,v in ipairs(queue) do print(i,v) end
1 do that
2 do the other thing
Code: Select all
>> queue = {"do this", "do that", "do something else"}
>>send(table.pop( queue))
do this
>> for i,v in ipairs(queue) do print(i,v) end
1 do that
2 do the other thing
In the example in the original post integer keys were used so the order is explicitly the order of those numbers.Vadi wrote:Just keep in mind that key-pair tables in Lua don't preserve order. If you'd like to keep it, use the "php-like" tables available from here: http://lua-users.org/wiki/MakingLuaLikePhp