Module:MHGraph

From Comprehensible Input Wiki
Revision as of 01:36, 29 March 2023 by Dimpizzy (talk | contribs) (Created page with "local p = {} function createTable() local g = mw.ext.externaldata.getWebData { url = 'https://meta.miraheze.org/w/api.php?action=wikidiscover&wdsiteprop=creation&format=json&wdlimit=5000', data = {creation}, format = 'JSON' } list = {} for key, value in ipairs(g) do table.insert(list, value['creation']) end table.sort(list) return list end function dump(o) if type(o) == 'table' then local s =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}

function createTable()

    local g = mw.ext.externaldata.getWebData {
        url = 'https://meta.miraheze.org/w/api.php?action=wikidiscover&wdsiteprop=creation&format=json&wdlimit=5000',
        data = {creation},
        format = 'JSON'
    }
	
	list = {}

    for key, value in ipairs(g) do
        table.insert(list, value['creation'])
    end
    
    table.sort(list)

    return list

end

function dump(o)
   if type(o) == 'table' then
      local s = '{ '
      for k,v in pairs(o) do
         if type(k) ~= 'number' then k = '"'..k..'"' end
         s = s .. '['..k..'] = ' .. dump(v) .. ','
      end
      return s .. '} '
   else
      return tostring(o)
   end
end




p.showList = function()
	return dump(createTable())
end


return p