Implementation of values and indexes transform functions for state tables. @centau defined its use and functionality as related to the transformation and creation of new states.
local names = source({ "Eli", "Bobby" })
local frames = values(names , function(i, name)
--> 'i' (index/key) remains constant and will not be transformed when values are returned
return create("Frame") { Name = name }
end)
--> Results:
--> frames = { [1] = Eli (Instance), [2] = Bobby (Instance) }
local numbers = source({ 1, 2, 3, 4, 5 })
local multiples = indexes(numbers , function(i, v)
--> 'v' (value) remains constant and will not be transformed when values are returned
return tostring(i)
end)
--> Results:
--> multiples = { ["1"] = 1, ["2"] = 2, ["3"] = 3, ["4"] = 4 }
Implementation of
values
andindexes
transform functions for state tables. @centau defined its use and functionality as related to the transformation and creation of new states.