Module:Sandbox/AnataBakka/Quotes

-- local p   = {} local lib      = require('Module:Feature') local wikidata = mw.loadData('Module:ChampionData/data')

function p.get(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end local s = "" local champtable = {} local inputlist = args["list"]*100 for championname in pairs (wikidata) do       if championname ~= "Kled & Skaarl" then table.insert(champtable,championname) end end table.sort(champtable) for index,championname in pairs (champtable) do       if index > inputlist-100 then if index <= inputlist then local titleobject = mw.title.new(championname.."/Quotes") local a = split(string.gsub(titleobject:getContent,"'",""),"") local b = "" local j = 2 while j ~= nil do                   if a[j] ~=nil then b = b .. a[j] .. "\n\n" j = j+2 else break end end s = s .. "\n\n=="..championname.."==\n" .. b           else break end end end return s end

function split(str, pattern) -- Splits string into a table --   -- str: string to split -- pattern: pattern to use for splitting local out = {} local i = 1 local split_start, split_end = string.find(str, pattern, i)   while split_start do        out[#out+1] = string.sub(str, i, split_start-1) i = split_end+1 split_start, split_end = string.find(str, pattern, i)   end out[#out+1] = string.sub(str, i)   return out end

return p --