er2.getAllSoldiers 73
Get all alive soldiers.
Notice: After a new soldier spawns or dies, this function might get a few instant before returning a correctly updated value.
Return value
Return Type | Description |
---|---|
void | This function doesn't return anything |
Parameters
Parameter | Type | Description |
---|---|---|
1 | Table | A Lua initialized Table to fill with found soldiers |
Examples
Example 43
--get a list of all soldiers in battle
local allSoldiers = {} -- Create an empty table.
er2.getAllSoldiers(allSoldiers); -- fill it with all soldiers currently alive
--print the name of each soldier
for key, soldier in pairs(allSoldiers) do
print("Name: "..soldier.getName())
end