Difference between revisions of "Module:Item"
Jump to navigation
Jump to search
blackwiki>Petr Matas (←Created page with 'local p = {} function escape(str) return str:gsub("([|\\])", "\\%1") end function p.main(frame) local parent = frame:getParent() local result = '' for ke...') |
blackwiki>Petr Matas |
||
| Line 10: | Line 10: | ||
local result = '' | local result = '' | ||
for key, value in pairs(parent.args) do | for key, value in pairs(parent.args) do | ||
| − | result = result .. "|" .. escape(key) .. "|" .. escape(value) | + | result = result .. "|" .. escape(tostring(key)) .. "|" .. escape(value) |
end | end | ||
Revision as of 02:40, 13 December 2015
This template implements {{Item}}, {{Component}} and {{Format item}}.
local p = {}
function escape(str)
return str:gsub("([|\\])", "\\%1")
end
function p.main(frame)
local parent = frame:getParent()
local result = ''
for key, value in pairs(parent.args) do
result = result .. "|" .. escape(tostring(key)) .. "|" .. escape(value)
end
return result;
end
return p