README.md: Return from example fold methods (#8)

This commit is contained in:
celeron55 2024-08-29 15:35:28 +03:00 committed by GitHub
parent 08bc018f92
commit 8d6f1ade93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -40,9 +40,10 @@ mymod.speed_monoid = player_monoids.make_monoid({
end, end,
fold = function(tab) fold = function(tab)
local res = 1 local res = 1
for _, speed in pairs(tab) do for _, speed in pairs(tab) do
res = res * speed res = res * speed
end end
return res
end, end,
identity = 1, identity = 1,
apply = function(speed, player) apply = function(speed, player)
@ -108,9 +109,10 @@ newmod.speed_boosts = player_monoids.make_monoid({
end, end,
fold = function(tab) fold = function(tab)
local res = 1 local res = 1
for _, speed in pairs(tab) do for _, speed in pairs(tab) do
res = math.max(res, speed) res = math.max(res, speed)
end end
return res
end, end,
identity = 1, identity = 1,
apply = ??? apply = ???