<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/GetAllElementsStartingAt?action=history&amp;feed=atom</id>
	<title>GetAllElementsStartingAt - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/GetAllElementsStartingAt?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetAllElementsStartingAt&amp;action=history"/>
	<updated>2026-05-15T08:23:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetAllElementsStartingAt&amp;diff=34326&amp;oldid=prev</id>
		<title>Gothemsh: Created page with &quot;{{Useful Function}} __NOTOC__ This function can be used to itinerate through a whole tree without having an element type. useful to get all the elements of a custom map.&lt;br&gt; * ''...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetAllElementsStartingAt&amp;diff=34326&amp;oldid=prev"/>
		<updated>2012-12-22T21:40:06Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Useful Function}} __NOTOC__ This function can be used to itinerate through a whole tree without having an element type. useful to get all the elements of a custom map.&amp;lt;br&amp;gt; * &amp;#039;&amp;#039;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Useful Function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function can be used to itinerate through a whole tree without having an element type. useful to get all the elements of a custom map.&amp;lt;br&amp;gt;&lt;br /&gt;
* '''NOTE:''' This need more testing specially in deeps trees.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getAllElementsStartingAt(element theStartingElement )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''theStartingElement''': The element where the itineration will start, searching through all the childrens&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Function source&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function getAllElementsStartingAt(startElement)&lt;br /&gt;
	local tabla = {}&lt;br /&gt;
	for k,v in ipairs(getElementChildren(startElement)) do&lt;br /&gt;
		table.insert(tabla,v)&lt;br /&gt;
		local childs = getElementChildren(startElement)&lt;br /&gt;
		if #childs &amp;gt; 0 then&lt;br /&gt;
			for q,w in ipairs(getAllElementsStartingAt(v)) do&lt;br /&gt;
				table.insert(tabla,w)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return tabla&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example change all the elements of a whole map to the fifth dimension&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
for k,v in ipairs(getAllElementsStartingAt(mapRoot)) do&lt;br /&gt;
	setElementDimension(v,5)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Gothem&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Gothemsh</name></author>
	</entry>
</feed>