Jump to content

Module:TestModule: Difference between revisions

From NewsWikiTestbed
AdamZachar (talk | contribs)
No edit summary
AdamZachar (talk | contribs)
No edit summary
Line 19: Line 19:
  end
  end


  return data[2].shape
  return output
end
end


return p
return p

Revision as of 10:31, 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'
  }
 names = {'John', 'Joe', 'Steve'}
 for i, row in ipairs(data) do
  output = output .. " " .. row.shape
 end

 return output
end

return p