Module RELIGION_LIST_SCRIPT_INTERFACE
List interface for religions present in a region.
Functions
| is_empty () | Checks whether this religion list is empty. |
| item_at (index) | Retrieves the religion object (RELIGION_SCRIPT_INTERFACE) at a zero-based index (0 to num_items() - 1). |
| num_items () | Number of religious denominations in this list. |
Functions
- is_empty ()
-
Checks whether this religion list is empty.
Returns:
-
boolean
true when the list has no religions, false otherwise
Usage:
if not rel_list:is_empty() then local dominant_rel = rel_list:item_at(0) end
- item_at (index)
-
Retrieves the religion object (RELIGION_SCRIPT_INTERFACE) at a zero-based index (
0tonum_items() - 1).Parameters:
- index integer zero-based list index
Returns:
-
RELIGION_SCRIPT_INTERFACE or nil
religion object, or nil when out of bounds
Usage:
for i = 0, rel_list:num_items() - 1 do local rel = rel_list:item_at(i) local key = rel:GetKey() local pct = rel:GetProportion() * 100 end
- num_items ()
-
Number of religious denominations in this list.
Returns:
-
integer
number of religions
Usage:
local count = rel_list:num_items()