Revision Difference
Global.RandomPairs#511336
<function name="RandomPairs" parent="Global" type="libraryfunc">⤶
<description>Returns an iterator function that can be used to loop through a table in random order</description>⤶
<realm>Shared and Menu</realm>⤶
<file line="575">lua/includes/extensions/table.lua</file>⤶
<args>⤶
<arg name="table" type="table">Table to create iterator for</arg>⤶
<arg name="descending" type="boolean">Whether the iterator should iterate descending or not</arg>⤶
</args>⤶
<rets>⤶
<ret name="" type="function">Iterator function</ret>⤶
</rets>⤶
</function>⤶
⤶
<example>⤶
<description>Creates a table and prints its contents in random order</description>⤶
<code>⤶
local tab = {"a", "b", "c", "d", "e", "f"}⤶
⤶
for k, v in RandomPairs(tab) do⤶
print(v)⤶
end⤶
</code>⤶
<output>⤶
b⤶
d⤶
f⤶
c⤶
a⤶
e⤶
</output>⤶
⤶
</example>