Module:Sandbox/Gpmat/test2

Revision as of 07:35, 12 July 2020 by imported>Gpmat
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Sandbox/Gpmat/test2/doc

local p = {}
local t = ""
local mod1 = require "Module:Sandbox/Gpmat/test"

local max = mw.loadData('Module:Sandbox/Gpmat/test/max')
local gare = mw.loadData('Module:Sandbox/Gpmat/test/gare')

function p.vuote(frame)

local anno = tonumber(frame.args[1])
local ritiro = tonumber(frame.args[2])
local str

if ritiro == nil then
ritiro = 0
end

if max[ritiro]-gare[anno] ~= 0 then
str = "||width=3%| "
for i=2,(max[ritiro]-gare[anno]) do
  str = str .. "||width=3%| "
end
end

return str

end

function p.celle(frame)
local anno = tonumber(frame.args[1])

local input = {frame.args[2], frame.args[1]}
local input2 = {frame.args[2], frame.args[3]}
col = mod1.main(input)
res = mod1.render(input2)
t = "|width=3% " .. col .. "| " .. res

 for i=4,(gare[anno]*2+1),2 do
   if frame.args[i] ~= nil then
     j=i+1
     res = frame.args[i]
     input = {frame.args[i],frame.args[1]}
     input2 = {frame.args[i],frame.args[j]}
     col = mod1.main(input)
     res = mod1.render(input2)
     t = t .. "||width=3% " .. col .. "| " .. res
   else t = t .. "||width=3%| "
 end
      
end
return t
end


return p