As the previous person said, no, you have to do it:
local cache = {}
for _, v in pairs(t) do
cache[v] = someExpensiveFunction(v)
end
table.sort(t, function(a, b)
return cache[a] > cache[b]
end)
As the previous person said, no, you have to do it:
local cache = {}
for _, v in pairs(t) do
cache[v] = someExpensiveFunction(v)
end
table.sort(t, function(a, b)
return cache[a] > cache[b]
end)