I want a function to concatenate two lists.
items = a:Append(b)
I want a function to map a function over a list.
Model:GetChildren():Map(function(n) n:Destroy() end)
or better
Model:GetChildren():Map(n => n:Destroy())
I want a function to map a selector over a list to generate a new list.
items = items:Where(n => onSale == true)
I want to sort this way instead of with fiddly comparators
items = items:OrderByDesc(n => n.Name)
In C# or JS these are all one-liners. In Lua I’m in for loop city constantly. Is there any thought being given to expanding the standard library?
I want to be able to do this:
var title = entries.Where(e => e.Approved)
.OrderBy(e => e.Rating).Select(e => e.Title)
.FirstOrDefault();
This would be a page of code today in Roblox Lua and it would not be readable.
Look at this code I had to write today. Yuck. Unfortunately, I have additional lists to merge.
local items = {}
function buildDb()
local a = game.ReplicatedStorage.RewardItems:GetChildren()
local b = game.ReplicatedStorage.ShopItems.Hats:GetChildren()
for i = 1,#a do
items[#items + 1] = a[i]
end
for i = 1,#b do
items[#items + 1] = b[i]
end
end