1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
Iterable types
==============
.. include:: version.rst
List Iterable
-------------
An iterable with defined size and order.
.. code-block:: Lua
-- can iterate over the list with pairs
for i, v in pairs(list) do
-- ...
end
.. code-block:: Lua
-- can iterate over the list with ipairs
for i, v in ipairs(list) do
-- ...
end
.. code-block:: Lua
-- can get total size with the size # operator
local length = #list
.. code-block:: Lua
-- can index the list with numbers
for i = 1, length do
list[i]
end
Map Iterable
------------
An iterable with undefined order.
.. code-block:: Lua
-- can iterate over the map with pairs
for k, v in pairs(map) do
-- ...
end
.. code-block:: Lua
-- can index the map by key
map[key]
|