Difference between revisions of "MIST makeUnitTable"

From DCS World Wiki - Hoggitworld.com
 
Line 5: Line 5:
 
|vNum = Mist 1.0
 
|vNum = Mist 1.0
  
|desc= This function accepts table t (which must be indexed sequentially starting at 1), applies the UnitNameTable short-cut rules, and returns a new table of unit names.  Also, this function adds the table key and value processed = true to the returned table, indicating that the table has already been “run through” the UnitNameTable processing/shortcuts (useful for self-rescheduling functions- obviously, you only need to apply the UnitNameTable rules the first time a self-rescheduling function is run!). |
+
|desc= This function accepts table t (which must be indexed sequentially starting at 1), applies the UnitNameTable short-cut rules, and returns a new table of unit names.  Also, this function adds the table key and value processed = true to the returned table, indicating that the table has already been “run through” the UnitNameTable processing/shortcuts (useful for self-rescheduling functions- obviously, you only need to apply the UnitNameTable rules the first time a self-rescheduling function is run!).  
 +
 
 +
 
 +
Optional value "exclude" is used to exclude a certain category of unit object. Accepts lower case string or table of strings. Valid entries are:
 +
    'plane', helicopter', 'vehicle', 'ship', 'static'
  
|vars= true
 
  
 
|rtnType= table
 
|rtnType= table
Line 31: Line 34:
 
|reqName5=  
 
|reqName5=  
  
|optType1=  
+
|optType1= string/table
  
|optName1=  
+
|optName1= exclude
  
 
|optName2=
 
|optName2=
Line 54: Line 57:
  
  
|rtnExamples= [[exampleUnitNameTable|Example unitNameTable]]
+
|rtnExamples=  
 
+
    {
|example= The following code will deploy a smoke marker randomly inside a zone.
+
        [1] = "Unit1',
 +
        [2] = "Unit2',
 +
        [3] = "Unit3',
 +
        [4] = "Unit4',
 +
        processed = 235.542,
 +
    }
  
<code>
+
|example=
do
+
The following would return a list of all objects except for statics.
  
end
+
    do
</code>
+
        local units = mist.makeUnitTable({'[all]'}, 'static')
 +
    end
 
|notes= See [[unitNameTables]]
 
|notes= See [[unitNameTables]]
  
|funcs= list of funcs using unitNameTables
+
|funcs= List of functions that use unitNameTables:
 +
[[MIST makeUnitTable|makeUnitTable]], [[MIST units_in_zones|units_in_zones]], [[MIST units_in_moving_zones|units_in_moving_zones]], [[MIST units_in_polygon|units_in_polygon]], [[MIST units_LOS|units_LOS]], [[MIST getUnitsInZones|getUnitsInZones]], [[MIST getUnitsInMovingZones|getUnitsInMovingZones]], [[MIST pointInPolygon|pointInPolygon]], [[MIST getUnitsInPoly|getUnitsInPolygon]], [[MIST getUnitsLOS|getUnitsLOS]]
  
 
}}
 
}}
 
[[Category: MIST|makeUnitTable]]
 
[[Category: MIST|makeUnitTable]]

Revision as of 09:10, 18 November 2020


mist.makeUnitTable

Added with: Mist 1.0
Description
This function accepts table t (which must be indexed sequentially starting at 1), applies the UnitNameTable short-cut rules, and returns a new table of unit names. Also, this function adds the table key and value processed = true to the returned table, indicating that the table has already been “run through” the UnitNameTable processing/shortcuts (useful for self-rescheduling functions- obviously, you only need to apply the UnitNameTable rules the first time a self-rescheduling function is run!).


Optional value "exclude" is used to exclude a certain category of unit object. Accepts lower case string or table of strings. Valid entries are:

   'plane', helicopter', 'vehicle', 'ship', 'static'
Syntax
table mist.makeUnitTable(table t , string/table exclude )
Valid Input Values:
See unitNameTables
Return value:
table
Return example:
{
        [1] = "Unit1', 
        [2] = "Unit2', 
        [3] = "Unit3', 
        [4] = "Unit4', 
        processed = 235.542,
   }
Usage Examples:
The following would return a list of all objects except for statics.
   do
       local units = mist.makeUnitTable({'[all]'}, 'static')
   end
Notes:
See unitNameTables
Related Functions
List of functions that use unitNameTables:

makeUnitTable, units_in_zones, units_in_moving_zones, units_in_polygon, units_LOS, getUnitsInZones, getUnitsInMovingZones, pointInPolygon, getUnitsInPolygon, getUnitsLOS

Scripting Engine

MIST Root Page