Jump to content

Module:Sandbox/Justinc/First

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Justinc (talk | contribs) at 15:04, 16 May 2013. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}
function p.hello(frame)
    return 'Hello from Lua'
end

function p.argument(frame)
  s = "<pre>\n"
  for k, v in pairs(frame.args) do
      s = s .. k .. " = " .. v .. "\n"
  end
  return s .. "\n</pre>"
end

function p.parent(frame)
    local parent = frame:getParent()
    s = "<pre>\n"
  for k, v in pairs(parent.args) do
      s = s .. k .. " = " .. v .. "\n"
  end
  return s .. "\n</pre>"
end

function p.stats(frame)
   return "Wikipedia has " .. mw.site.stats.pages    
end

return p