Difference between revisions of "Table.foreach"
From GiderosMobile
 (Created page with "__NOTOC__ '''Available since:''' Gideros 2022.3<br/> '''Class:''' table<br/>  === Description === Iterates over the provided table, passing the key and value of each itera...")  | 
				m (Text replacement - "<source" to "<syntaxhighlight")  | 
				||
| Line 5: | Line 5: | ||
=== Description ===  | === Description ===  | ||
Iterates over the provided table, passing the key and value of each iteration over to the provided function.  | Iterates over the provided table, passing the key and value of each iteration over to the provided function.  | ||
| − | <  | + | <syntaxhighlight lang="lua">  | 
table.foreach(t,function)  | table.foreach(t,function)  | ||
</source>  | </source>  | ||
Revision as of 14:31, 13 July 2023
Available since: Gideros 2022.3
Class: table
Description
Iterates over the provided table, passing the key and value of each iteration over to the provided function. <syntaxhighlight lang="lua"> table.foreach(t,function) </source>
Parameters
t: (table) the table to be iterated over
function: (function) the function that will be used for the iteration. This function will receive 2 arguments for each iteration, where the 1st argument is the key, and the 2nd argument is the value