Fix readme nested monoids example

This commit is contained in:
raymoo 2016-06-14 17:01:53 -07:00
parent d76cde2dc1
commit ef6f07b6fa
1 changed files with 2 additions and 2 deletions

View File

@ -104,12 +104,12 @@ the strongest boost. Most of it could be done the same way:
-- My speed boosts monoid takes speed multipliers (numbers) that are at least 1.
newmod.speed_boosts = player_monoids.make_monoid({
combine = function(speed1, speed2)
return speed1 * speed2
return math.max(speed1, speed2)
end,
fold = function(tab)
local res = 1
for _, speed in pairs(tab) do
res = res * speed
res = math.max(res, speed)
end
end,
identity = 1,