Module:ColorParse: Difference between revisions

Jump to navigation Jump to search
380 bytes added ,  17:33, 25 May 2020
auto generate shader template list
mNo edit summary
(auto generate shader template list)
Line 148: Line 148:
     local args = process_args.merge(true)
     local args = process_args.merge(true)
     if args[1] and args[2] then -- shader template
     if args[1] and args[2] then -- shader template
       output = p.applytemplate(args[1], args[2])
       output = applytemplate(args[1], args[2])
     else
     else
       output = p.shader(args['text'], args['colors'], args['type'])
       output = p.shader(args['text'], args['colors'], args['type'])
Line 160: Line 160:
end
end


function p.applytemplate(shader, text)
function applytemplate(shader, text)
   return p.shader(text, shaders[shader][1], shaders[shader][2])
   return p.shader(text, shaders[shader][1], shaders[shader][2])
end
function p.shaderlist()
  local tblheader = '<tr><th>Shader</th><th>Colors</th><th>Type</th></tr>'
  local tr = {}
  i = 0
  for a, v in pairs(shaders) do
      tr[i] = ' <tr><td>' .. applytemplate(a, a) .. '</td><td>' .. v[1] .. '</td><td>' .. v[2] .. '</td></tr>'
      i = i + 1
  end
  return '<table class="wikitable">' .. tblheader  .. table.concat(tr) .. '</table>'
end
end


function p.test()
function p.test()
     return p.applytemplate('structural', 'structural')
     return applytemplate('structural', 'structural')
     --return p.shader('Stopsvalinn', 'R-r-K-y-Y', 'sequence')
     --return p.shader('Stopsvalinn', 'R-r-K-y-Y', 'sequence')
end
end


return p
return p

Navigation menu