ElEditors, Interface administrators, Administrators
85,550
edits
No edit summary |
m (add template function) |
||
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, "%{(%w+)%}", (function(slotIndex) | |||
return data[tonumber(slotIndex)] or '' | |||
end)) | |||
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 |