Module:DiceUtils: Difference between revisions
Jump to navigation
Jump to search
(Undo revision 19565 by NamelessWonder (talk)) Tags: Undo Reverted |
(Undo revision 19566 by NamelessWonder (talk)) Tag: Undo |
||
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 28: | Line 28: | ||
d_type = string.sub(damage_die, idx + 1) | d_type = string.sub(damage_die, idx + 1) | ||
table.insert( | table.insert(tmp, d_type) | ||
end | end | ||
return table.concat(tmp, "<br>") | |||
return table.concat( | |||
end | end | ||
return p | return p |
Revision as of 07:27, 19 July 2023
Documentation for this module may be created at Module:DiceUtils/doc
local p = {}
function p.calculateDamage(frame)
args = frame.args
result = {}
damage = {
Acid = {},
Cold = {},
Fire = {},
Force = {},
Healing = {},
Lightning = {},
Necrotic = {},
Poison = {},
Radiant = {},
Thunder = {},
Psychic = {},
Physical = {},
Piercing = {},
Bludgeoning = {},
Slashing = {}
}
tmp = {}
for damage_die in string.gmatch(args.dice, "([^,]+)") do
idx = string.find(damage_die, ":")
die = string.sub(damage_die, 1, idx - 1)
d_type = string.sub(damage_die, idx + 1)
table.insert(tmp, d_type)
end
return table.concat(tmp, "<br>")
end
return p