Module:Library Listing: Difference between revisions

From Comprehensible Input Wiki
Content added Content deleted
(Created page with "local p = {} function createTable() local g = mw.ext.externaldata.getWebData { url = 'https://comprehensibleinputwiki.com/api.php?count=true', data = {language, count}, format = 'JSON' } tableOut = '<table id="library-listing"><tr id="lib-header"><th>Language</th><th>Video Count</th></tr>' for key, value in ipairs(g) do tableOut = tableOut .. '<tr><td>[[' .. value['language'] .. '/Library ' .. value['language'] .. ']]</...")
 
No edit summary
Line 23: Line 23:




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

Revision as of 00:41, 9 February 2023

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

local p = {}

function createTable()

    local g = mw.ext.externaldata.getWebData {
        url = 'https://comprehensibleinputwiki.com/api.php?count=true',
        data = {language, count},
        format = 'JSON'
    }

    tableOut = '<table id="library-listing"><tr id="lib-header"><th>Language</th><th>Video Count</th></tr>'

    for key, value in ipairs(g) do
        tableOut = tableOut .. '<tr><td>[[' .. value['language'] .. '/Library ' .. value['language'] .. ']]</td><td>' .. value['count'] .. '</td></tr>'
    end

    tableOut = tableOut .. '</table>'

    return tableOut

end



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


return p