ForValues -> For<K, VO> ¶
function Fusion.ForValues<K, VI, VO, S>(
scope: Scope<S>,
inputTable: UsedAs<{[K]: VI}>,
processor: (Use, Scope<S>, value: VI) -> VO
) -> For<K, VO>
Constructs and returns a new For state object which processes values and preserves keys.
Use scoped() method syntax
This function is intended to be accessed as a method on a scope:
local forObj = scope:ForValues(inputTable, processor)
Parameters¶
scope : Scope<S> ¶
The scope which should be used to store destruction tasks for this object.
inputTable : UsedAs<{[K]: VI}> ¶
The table which will provide the input keys and input values for this object.
If it is a state object, this object will respond to changes in that state.
processor : (Use, Scope<S>, value: VI) -> VO ¶
Accepts a VI
value from the input table, and returns the VO
value that
should appear in the output table.
The processor is given a use function for including other objects in the computation, and a scope for queueing destruction tasks to run on re-computation. The given scope has the same methods as the scope used to create the whole object.
Returns -> For<K, VO> ¶
A freshly constructed For state object.