Module:TeamTotoSandbox: Difference between revisions

mNo edit summary
No edit summary
Line 211: Line 211:


function p.shaderlist()
function p.shaderlist()
   local tblheader = '<tr><th>Shader</th><th>Colors</th><th>Type</th></tr>'
   local tblheader = '<tr><th>Shader</th><th>Colors</th><th>Type</th></tr>'
   local tr = {}
   local tr = {}
   i = 0
   local sorted_shaders = {}
   for a, v in pairs(shaders) do
  -- Sort keys --
       tr[i] = ' <tr><td><b>' .. applytemplate(a, a, 'true') .. '</b></td><td>' .. v[1] .. '</td><td>' .. v[2] .. '</td></tr>'
  for n in pairs(shader) do table.insert(sorted_shaders, n) end
      i = i + 1
  table.sort(sorted_shaders)
  -- Do logic on the sorted table --
   for i, a in ipairs(sorted_shaders) do
    local v = shader[a]
       tr[i] = ' <tr><td>' .. applytemplate(a, a, 'true') .. '</td><td>' .. v[1] .. '</td><td>' .. v[2] .. '</td></tr>'
   end
   end
   return '<table class="wikitable sortable">' .. tblheader  .. table.concat(tr) .. '</table>'
   return '<table class="wikitable sortable">' .. tblheader  .. table.concat(tr) .. '</table>'