Module:DiceUtils: Difference between revisions

Jump to navigation Jump to search
No edit summary
No edit summary
Line 22: Line 22:
Slashing = {}
Slashing = {}
}
}
tmp = {}
for damage_die in string.gmatch(args.dice, "([^,]+)") do
for damage_die in string.gmatch(args.dice, "([^,]+)") do
idx = string.find(damage_die, ":")
idx = string.find(damage_die, ":")
Line 32: Line 32:
for d_type, dice in pairs(damage) do
for d_type, dice in pairs(damage) do
if not next(dice) == nil then
if not (next(dice) == nil) then
min_damage = 0
min_damage = 0
max_damage = 0
max_damage = 0
Line 48: Line 48:
damage_str = string.format("%s %s %s", table.concat(dice, " + "), d_type, avg_str)
damage_str = string.format("%s %s %s", table.concat(dice, " + "), d_type, avg_str)
table.insert(result, damage_str)
table.insert(damage_str)
end
end
end
end