Module POLITICAL_PARTY_LIST_SCRIPT_INTERFACE
List interface for campaign political parties.
Functions
| is_empty () | Checks whether this political party list is empty. |
| item_at (index) | Retrieves the political party at a zero-based index (0 to num_items() - 1). |
| num_items () | Number of political parties in this list. |
Functions
- is_empty ()
-
Checks whether this political party list is empty.
Returns:
-
boolean
true when the list has no parties, false otherwise
Usage:
if not party_list:is_empty() then local first_party = party_list:item_at(0) end
- item_at (index)
-
Retrieves the political party at a zero-based index (
0tonum_items() - 1).Parameters:
- index integer zero-based list index
Returns:
-
CAMPAIGN_POLITICAL_PARTY_SCRIPT_INTERFACE or nil
political party object, or nil when out of bounds
Usage:
for i = 0, party_list:num_items() - 1 do local party = party_list:item_at(i) if party:IsPrimary() then -- Found ruling party end end
- num_items ()
-
Number of political parties in this list.
Returns:
-
integer
number of parties
Usage:
local count = party_list:num_items()