Jump to content

Module:TestData: Difference between revisions

From ANRC Universe
Created page with "local p = {} function p.main() local d = mw.ext.data.get('I18n/Uses.tab') return type(d) .. ' rows=' .. tostring(#(d.data or {})) end return p"
 
No edit summary
 
Line 1: Line 1:
local p = {}
local p = {}
function p.main()
 
   local d = mw.ext.data.get('I18n/Uses.tab')
function p.main(frame)
   return type(d) .. ' rows=' .. tostring(#(d.data or {}))
   local dataset = frame.args[1] or 'c:Data:I18n/Uses_TemplateStyles.tab'
 
  local data, err = mw.ext.data.get(dataset)
 
   if data == false or type(data) ~= 'table' then
    return string.format(
      "FAILED loading dataset: %s\n\nReturned type: %s\nError: %s",
      dataset,
      type(data),
      tostring(err)
    )
  end
 
  -- Show something small so we know it loaded
  return "OK loaded: " .. dataset
end
end
return p
return p

Latest revision as of 04:08, 7 February 2026

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

local p = {}

function p.main(frame)
  local dataset = frame.args[1] or 'c:Data:I18n/Uses_TemplateStyles.tab'

  local data, err = mw.ext.data.get(dataset)

  if data == false or type(data) ~= 'table' then
    return string.format(
      "FAILED loading dataset: %s\n\nReturned type: %s\nError: %s",
      dataset,
      type(data),
      tostring(err)
    )
  end

  -- Show something small so we know it loaded
  return "OK loaded: " .. dataset
end

return p