mirror of
https://github.com/minetest-mods/player_monoids.git
synced 2025-01-09 17:10:19 +01:00
Fix readme nested monoids example
This commit is contained in:
parent
d76cde2dc1
commit
ef6f07b6fa
@ -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.
|
-- My speed boosts monoid takes speed multipliers (numbers) that are at least 1.
|
||||||
newmod.speed_boosts = player_monoids.make_monoid({
|
newmod.speed_boosts = player_monoids.make_monoid({
|
||||||
combine = function(speed1, speed2)
|
combine = function(speed1, speed2)
|
||||||
return speed1 * speed2
|
return math.max(speed1, speed2)
|
||||||
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 = math.max(res, speed)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
identity = 1,
|
identity = 1,
|
||||||
|
Loading…
Reference in New Issue
Block a user