SlashCo Wiki

SlashCo.AssembleWeightedTable

 table SlashCo.AssembleWeightedTable( table<Entity> elements, function conditions = SlashCo.DefaultConditions )

Description

Assembles a weighted table for use by the spawning functions.
Each element that passes the supplied conditions is added using its Weight value,
or a default weight of 10 when no weight is specified.

Arguments

1table<Entity> elements

Sequential table of entities to consider

2function conditions = SlashCo.DefaultConditions

Optional function used to determine whether each entry should be included

Returns

1table weightedTable

Table mapping each accepted element to its weight