Module:Resistances: Difference between revisions

From Exiled Kingdoms Wiki
mNo edit summary
mNo edit summary
Line 8: Line 8:
     for key,value in ipairs(RawRess)  
     for key,value in ipairs(RawRess)  
     do
     do
         if (value > 0) then
         if (tonumber(value) > 0) then
             todisp = todisp + string.format("[[File:%s.png|16px|link=%s]] %s ", resnm[key], resnm[key], value)
             todisp = todisp + string.format("[[File:%s.png|16px|link=%s]] %s ", resnm[key], resnm[key], value)
         end
         end

Revision as of 22:24, 6 June 2017

local p = {} -- tmparg = args(...) resnm = {'Fire', 'Cold', 'Shock', 'Death', 'Toxic', 'Spirit'}

function p.Disp()

   todisp = 
   RawRess = mw.text.split('0,0,10,0,0,0',',',true)
   for key,value in ipairs(RawRess) 
   do
       if (tonumber(value) > 0) then
           todisp = todisp + string.format("File:%s.png %s ", resnm[key], resnm[key], value)
       end
   end
   return todisp

end

function p.Vuln(RawRes, vto, vval, gtles)

   RawRess = mw.text.split(RawRes,',',true)
   isvuln = 0
   vnum = RawRess[resnm[vto]]
   if ( vnum > vval) then
       isvuln = 1
   end
   return isvuln

end

return p