Module:Inventory: Difference between revisions
From Exiled Kingdoms Wiki
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
p = {} | p = {} | ||
invName = mw.getCurrentFrame().args[1] | -- invName = mw.getCurrentFrame().args[1] | ||
invItm = mw.getCurrentFrame().args[ | invItm = mw.getCurrentFrame().args[1] | ||
invArm = mw.getCurrentFrame().args[ | invArm = mw.getCurrentFrame().args[2] | ||
invWpn = mw.getCurrentFrame().args[ | invWpn = mw.getCurrentFrame().args[3] | ||
invMark = mw.getCurrentFrame().args[ | invMark = mw.getCurrentFrame().args[4] | ||
invFunc = mw.getCurrentFrame().args[ | invFunc = mw.getCurrentFrame().args[5] | ||
function p.getItems() | function p.getItems() | ||
itmtxt = '' | |||
if invMark == nil then | if invMark == nil then | ||
invMark = 1 | invMark = 1 | ||
Line 13: | Line 14: | ||
if (invItm ~= nil) then | if (invItm ~= nil) then | ||
Items = mw.text.split(invItm,';',true) | Items = mw.text.split(invItm,';',true) | ||
argtbl = { 'ItmCityTblx', string.format('Markup=%s',invMark)} | argtbl = { 'ItmCityTblx', string.format('Markup=%s',invMark)} | ||
for k, itm in ipairs(Items) do | for k, itm in ipairs(Items) do | ||
Line 22: | Line 22: | ||
end | end | ||
if (invArm ~= nil) then | if (invArm ~= nil) then | ||
Items = mw.text.split(invArm,';',true) | |||
argtbl = { 'ArmCityTblx', string.format('Markup=%s',invMark)} | |||
for k, itm in ipairs(Items) do | |||
inm = string.format(':%s',itm) | |||
itmtxt = itmtxt .. mw.getCurrentFrame():expandTemplate{ title = inm, args = argtbl } | |||
end | |||
end | end | ||
if (invWpn ~= nil) then | if (invWpn ~= nil) then | ||
Items = mw.text.split(invWpn,';',true) | |||
argtbl = { 'WpnCityTblx', string.format('Markup=%s',invMark)} | |||
for k, itm in ipairs(Items) do | |||
inm = string.format(':%s',itm) | |||
itmtxt = itmtxt .. mw.getCurrentFrame():expandTemplate{ title = inm, args = argtbl } | |||
end | |||
end | end | ||
end | end | ||
return p | return p |
Revision as of 05:09, 7 June 2017
p = {} -- invName = mw.getCurrentFrame().args[1] invItm = mw.getCurrentFrame().args[1] invArm = mw.getCurrentFrame().args[2] invWpn = mw.getCurrentFrame().args[3] invMark = mw.getCurrentFrame().args[4] invFunc = mw.getCurrentFrame().args[5]
function p.getItems()
itmtxt = if invMark == nil then invMark = 1 end if (invItm ~= nil) then Items = mw.text.split(invItm,';',true) argtbl = { 'ItmCityTblx', string.format('Markup=%s',invMark)} for k, itm in ipairs(Items) do inm = string.format(':%s',itm) itmtxt = itmtxt .. mw.getCurrentFrame():expandTemplate{ title = inm, args = argtbl } end return itmtxt end if (invArm ~= nil) then Items = mw.text.split(invArm,';',true) argtbl = { 'ArmCityTblx', string.format('Markup=%s',invMark)} for k, itm in ipairs(Items) do inm = string.format(':%s',itm) itmtxt = itmtxt .. mw.getCurrentFrame():expandTemplate{ title = inm, args = argtbl } end end if (invWpn ~= nil) then Items = mw.text.split(invWpn,';',true) argtbl = { 'WpnCityTblx', string.format('Markup=%s',invMark)} for k, itm in ipairs(Items) do inm = string.format(':%s',itm) itmtxt = itmtxt .. mw.getCurrentFrame():expandTemplate{ title = inm, args = argtbl } end end
end return p