From WikiChip
Difference between revisions of "Module:comp"

Line 1: Line 1:
local wikichip = require( "Module:wikichip" )
 
 
 
function split(str, sep)
 
function split(str, sep)
 
         if sep == nil then
 
         if sep == nil then
Line 17: Line 15:
  
 
function m.mpu_comp(frame)
 
function m.mpu_comp(frame)
 +
  local wikichip = require("Module:wikichip")
 
 
 
   if not frame.args.list then
 
   if not frame.args.list then

Revision as of 20:09, 17 May 2017

Documentation for this module may be created at Module:comp/doc

function split(str, sep)
        if sep == nil then
                sep = "%s"
        end
        local t={} ; i=1
        for str in string.gmatch(str, "([^"..sep.."]+)") do
                t[i] = str
                i = i + 1
        end
        return t
end


local m = {}

function m.mpu_comp(frame)
  local wikichip = require("Module:wikichip")
	
  if not frame.args.list then
    return 'Error: Missing chip list to compare!'
  end
	
  local list = split(frame.args.list, ',')
  local s = ''
  
  for key, chip_name in pairs(list) do
    local chip = wikichip.new(chip_name)
  end
  
  return s
  
end

return m