Module:TestModule: Difference between revisions
Appearance
AdamZachar (talk | contribs) No edit summary |
AdamZachar (talk | contribs) No edit summary |
||
Line 14: | Line 14: | ||
format = 'CSV with header' | format = 'CSV with header' | ||
} | } | ||
output = output .. "<ul>" | |||
for i, row in ipairs(data) do | for i, row in ipairs(data) do | ||
output = output .. " " .. row.shape | output = output .. " <li>" .. row.shape | ||
end | end | ||
output = output .. "</ul>" | |||
return output | return output |
Revision as of 10:36, 10 June 2025
local p = {} --p stands for package
function p.hello( frame )
return "Hello, world!"
end
function p.externalDataTest( frame )
local output = ""
local data, errors =
mw.ext.externaldata.getWebData
{
url = 'https://discoursedb.org/wiki/Special:GetData/Fruits_data',
data = {name = 'Name', color = 'Color', shape = 'Shape'},
format = 'CSV with header'
}
output = output .. "<ul>"
for i, row in ipairs(data) do
output = output .. " <li>" .. row.shape
end
output = output .. "</ul>"
return output
end
return p