<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.fortress-forever.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Lua%3ACollection</id>
	<title>Lua:Collection - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.fortress-forever.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Lua%3ACollection"/>
	<link rel="alternate" type="text/html" href="https://www.fortress-forever.com/wiki/index.php?title=Lua:Collection&amp;action=history"/>
	<updated>2026-08-08T11:26:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.11</generator>
	<entry>
		<id>https://www.fortress-forever.com/wiki/index.php?title=Lua:Collection&amp;diff=9237&amp;oldid=prev</id>
		<title>Crazycarl at 17:25, 28 July 2009</title>
		<link rel="alternate" type="text/html" href="https://www.fortress-forever.com/wiki/index.php?title=Lua:Collection&amp;diff=9237&amp;oldid=prev"/>
		<updated>2009-07-28T17:25:59Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:25, 28 July 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{Infobox mapping}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Collection()=&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Collection()=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l257&quot; &gt;Line 257:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 258:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  -- get all blue snipers&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  -- get all blue snipers&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  col:GetByFilter( { CF.kPlayers, CF.kPlayerSniper, CF.kTeamBlue } )&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  col:GetByFilter( { CF.kPlayers, CF.kPlayerSniper, CF.kTeamBlue } )&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Lua]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Crazycarl</name></author>
	</entry>
	<entry>
		<id>https://www.fortress-forever.com/wiki/index.php?title=Lua:Collection&amp;diff=9236&amp;oldid=prev</id>
		<title>Crazycarl: New page: =Collection()=  A collection is a list of entities you can use to keep track of game objects. For example, you could keep a list of all players, or of all players touching a trigger, or al...</title>
		<link rel="alternate" type="text/html" href="https://www.fortress-forever.com/wiki/index.php?title=Lua:Collection&amp;diff=9236&amp;oldid=prev"/>
		<updated>2009-07-28T17:25:12Z</updated>

		<summary type="html">&lt;p&gt;New page: =Collection()=  A collection is a list of entities you can use to keep track of game objects. For example, you could keep a list of all players, or of all players touching a trigger, or al...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Collection()=&lt;br /&gt;
&lt;br /&gt;
A collection is a list of entities you can use to keep track of game objects. For example, you could keep a list of all players, or of all players touching a trigger, or all sentries belonging to blue team.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Functions==&lt;br /&gt;
===AddItem===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:AddItem( entity )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Adds the entity to the collection&lt;br /&gt;
&lt;br /&gt;
Returns: nothing&lt;br /&gt;
&lt;br /&gt;
*entity(CBaseEntity) An entity&lt;br /&gt;
Code:&lt;br /&gt;
 &lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 trigger_name = trigger_ff_script:new()&lt;br /&gt;
 function trigger_name:ontouch( touch_entity )&lt;br /&gt;
     col:AddItem( touch_entity )&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:AddItem( TableOfEntities )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Adds each entity in the table to the collection&lt;br /&gt;
&lt;br /&gt;
Returns: nothing&lt;br /&gt;
&lt;br /&gt;
*TableOfEntities(table) Entities separated by commas enclosed in { }&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 trigger_name = trigger_ff_script:new()&lt;br /&gt;
 function trigger_name:ontouch( touch_entity )&lt;br /&gt;
     col:AddItem( { touch_entity, GetEntityByName( &amp;quot;entity_name&amp;quot; ) } )&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===RemoveItem===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:RemoveItem( entity )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Removes the entity from the collection&lt;br /&gt;
&lt;br /&gt;
Returns: nothing&lt;br /&gt;
&lt;br /&gt;
*entity(CBaseEntity) An entity&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 trigger_name = trigger_ff_script:new()&lt;br /&gt;
 function trigger_name:onendtouch( touch_entity )&lt;br /&gt;
     col:RemoveItem( touch_entity )&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:RemoveItem( TableOfEntities )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Removes each entity in the table from the collection&lt;br /&gt;
&lt;br /&gt;
Returns: nothing&lt;br /&gt;
&lt;br /&gt;
*TableOfEntities(table) Entities separated by commas enclosed in { }&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 trigger_name = trigger_ff_script:new()&lt;br /&gt;
 function trigger_name:onendtouch( touch_entity )&lt;br /&gt;
     col:RemoveItem( { touch_entity, GetEntityByName( &amp;quot;entity_name&amp;quot; ) } )&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===RemoveAllItems===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:RemoveAllItems()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Removes all items from the collection (clears the collection)&lt;br /&gt;
&lt;br /&gt;
Returns: nothing&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 trigger_name = trigger_ff_script:new()&lt;br /&gt;
 function trigger_name:oninactive()&lt;br /&gt;
     col:RemoveAllItems( )&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===IsEmpty===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:IsEmpty()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Verifies whether or not the collection is empty&lt;br /&gt;
&lt;br /&gt;
Returns: boolean (true or false)&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 if col:IsEmpty() then&lt;br /&gt;
    --do something&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===Count===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:Count()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Gives the number of items in the collection&lt;br /&gt;
&lt;br /&gt;
Returns: number of items (int)&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 if col:Count() &amp;gt; 5 then&lt;br /&gt;
    --do something&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===NumItems===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:NumItems()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Alias for collection:Count()&lt;br /&gt;
&lt;br /&gt;
===HasItem===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:HasItem( entity )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Verifies whether or not the collection contains the entity&lt;br /&gt;
&lt;br /&gt;
Returns: boolean (true or false)&lt;br /&gt;
&lt;br /&gt;
*entity(CBaseEntity) An entity&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 if col:HasItem( GetEntityByName(&amp;quot;entity_name&amp;quot;) ) then&lt;br /&gt;
   -- do something&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:HasItem( TableOfEntities )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Verifies whether or not the collection contains at least one of the entities in the table&lt;br /&gt;
&lt;br /&gt;
Returns: boolean (true or false)&lt;br /&gt;
&lt;br /&gt;
*TableOfEntities(table) Entities separated by commas enclosed in { }&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 if col:HasItem( { GetEntityByName(&amp;quot;entity_name&amp;quot;), GetEntityByName(&amp;quot;ent2&amp;quot;) } ) then&lt;br /&gt;
   -- do something&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===GetItem===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:GetItem( entity )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Gives the entity you pass it if the entity is found in the collection. Entirely useless?&lt;br /&gt;
&lt;br /&gt;
Returns: entity (CBaseEntity)&lt;br /&gt;
&lt;br /&gt;
*entity(CBaseEntity) An entity&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 local ent = col:GetItem( GetEntityByName(&amp;quot;entity_name&amp;quot;) )&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:GetItem( TableOfEntities )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Gives the first item from the table found in the collection. Entirely useless?&lt;br /&gt;
&lt;br /&gt;
Returns: entity (CBaseEntity)&lt;br /&gt;
&lt;br /&gt;
*TableOfEntities(table) Entities separated by commas enclosed in { }&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 local ent = col:GetItem( { GetEntityByName(&amp;quot;entity_name&amp;quot;), GetEntityByName(&amp;quot;ent2&amp;quot;) } )&lt;br /&gt;
&lt;br /&gt;
===Element===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:Element( number )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Gives the corresponding item from the collection&lt;br /&gt;
&lt;br /&gt;
Returns: entity (CBaseEntity)&lt;br /&gt;
&lt;br /&gt;
*number(integer) The number of the element you want to get, with the first element being at position 0&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 -- get the first element of the collection&lt;br /&gt;
 local ent = col:Element( 0 )&lt;br /&gt;
&lt;br /&gt;
===GetByName===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:GetByName( TableOfEntityNames )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Searches for entities with the inputted names and adds them to the collection&lt;br /&gt;
&lt;br /&gt;
Returns: nothing&lt;br /&gt;
&lt;br /&gt;
*TableOfEntityNames(table) Strings separated by commas enclosed in { }&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 col:GetByName( { &amp;quot;entity_name&amp;quot;, &amp;quot;ent2&amp;quot; } )&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:GetByName( TableOfEntityNames, TableOfFilters )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Searches for entities that match the filters with the inputted names and adds them to the collection&lt;br /&gt;
&lt;br /&gt;
Returns: nothing&lt;br /&gt;
&lt;br /&gt;
*TableOfEntityNames(table) Strings separated by commas enclosed in { }&lt;br /&gt;
*TableOfFilters(table) Filter flags separated by commas enclosed in { }. See flag prefix: CF&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 col:GetByName( { &amp;quot;entity_name&amp;quot;, &amp;quot;ent2&amp;quot; }, { CF.kInfoScipts, CF.kInfoScript_Carried } )&lt;br /&gt;
&lt;br /&gt;
===GetInSphere===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:GetInSphere( entity, radius, TableOfFilters )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Detects any entities that match the filters within distance from the origin of the entity and adds them to the collection&lt;br /&gt;
&lt;br /&gt;
IMPORTANT: The filter CF.kTraceBlockWalls is REQUIRED for this function to work&lt;br /&gt;
&lt;br /&gt;
Returns: nothing&lt;br /&gt;
&lt;br /&gt;
*entity(CBaseEntity) An entity&lt;br /&gt;
*radius(float) Radius around the entity to check&lt;br /&gt;
*TableOfFilters(table) Filter flags separated by commas enclosed in { }. See flag prefix: CF&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 col:GetInSphere( GetEntityByName(&amp;quot;entity_name&amp;quot;), 256, { CF.kTraceBlockWalls } )&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:GetInSphere( origin, radius, TableOfFilters )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Detects any entities that match the filters within distance from the origin and adds them to the collection&lt;br /&gt;
&lt;br /&gt;
IMPORTANT: The filter CF.kTraceBlockWalls is REQUIRED for this function to work&lt;br /&gt;
&lt;br /&gt;
Returns: nothing&lt;br /&gt;
&lt;br /&gt;
*origin(Vector) Origin of the check&lt;br /&gt;
*radius(float) Radius around the entity to check&lt;br /&gt;
*TableOfFilters(table) Filter flags separated by commas enclosed in { }. See flag prefix: CF&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 local origin = GetEntityByName(&amp;quot;entity_name&amp;quot;):GetOrigin()&lt;br /&gt;
 &lt;br /&gt;
 -- check for entities within a 128 unit radius 256 units above the entity and add them to the collection&lt;br /&gt;
 col:GetInSphere( Vector(origin.x, origin.y, origin.z + 256), 128, { CF.kTraceBlockWalls } )&lt;br /&gt;
&lt;br /&gt;
===GetByFilter===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;collection:GetByFilter( TableOfFilters )&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Finds any entities that match the filter(s) and adds them to the collection&lt;br /&gt;
&lt;br /&gt;
Returns: nothing&lt;br /&gt;
&lt;br /&gt;
*TableOfFilters(table) Filter flags separated by commas enclosed in { }. See flag prefix: [[CF]]&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
 local col = Collection()&lt;br /&gt;
 &lt;br /&gt;
 -- get all blue snipers&lt;br /&gt;
 col:GetByFilter( { CF.kPlayers, CF.kPlayerSniper, CF.kTeamBlue } )&lt;/div&gt;</summary>
		<author><name>Crazycarl</name></author>
	</entry>
</feed>