ElEditors, Interface administrators, Administrators
85,546
edits
No edit summary |
m (change fillTemplate fallback) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 110: | Line 110: | ||
end | end | ||
return result; | return result; | ||
end | |||
-- Implement templating string with slots. | |||
function fillTemplate(tpl, data) | |||
tpl = tpl or '' | |||
data = data or {} | |||
return string.gsub(tpl, "%{(%d+)%}", (function(slotIndex) | |||
return data[tonumber(slotIndex)] or ('{' .. slotIndex .. '}') | |||
end)) | |||
end | end | ||
Line 254: | Line 264: | ||
function formatDamage(number) | function formatDamage(number) | ||
local formattedDamage = number > 0 and (formatnum(math.round(number, 2)) .. '%') or ' | local formattedDamage = number > 0 and (formatnum(math.round(number, 2)) .. '%') or 'N/A' | ||
return formattedDamage | return formattedDamage | ||
end | end | ||
Line 270: | Line 280: | ||
end | end | ||
function table.fuse(t1,t2) | function table.fuse(t1, t2) | ||
for k, v in pairs(t2) do | for k, v in pairs(t2) do | ||
t1[k] = v | t1[k] = v |