Module:Validate

require('Module:StrManip')

local p = {}

function p.validate local str = mw.getCurrentFrame.args[1] --comma separated list of strings |||| !! with "empty" as empty value

--image,name,kana,type,subtype,series,medium

local str = "image.png,test,テスト,construct,program,the last module on this little wiki,a medium" error =

--if (strArg ~= nil) then --   str = strArg --end mw.logObject(str) local input = strSplit(str,",") --mw.logObject(input)

--check for empty values legend = {"Image","Name","Kana","Type","Series","Medium"} table = {input[1],input[2],input[3],input[4],input[6],input[7]} --mw.logObject(table) emptyVal = "" for i,val in ipairs(table) do       --mw.logObject(legend[i].." = "..val) if (val == "empty") then mw.logObject("! "..legend[i].." empty") emptyVal = emptyVal..legend[i].." | " --mw.logObject(emptyVal) error = " Fields | "..emptyVal.."need to be filled out. See Help:Guidelines. " end end types = {input[4],input[5]} mw.logObject(error) return error end

return p