local p =
local properties =
local methods =
local currentTitle = mw.title.getCurrentTitle
function p.main(frame) result = "" for _, property in ipairs(properties) do result = result .. "\n# " .. property .. ": " .. tostring(currentTitle[property]) end -- currentTitle[method](currentTitle) works because it emulates Lua's colon syntax. This syntax is often -- used in implementing Lua's version of object-oriented programming. Take a look at -- http://www.lua.org/pil/16.html for a good explanation. for _, method in ipairs(methods) do result = result .. "\n# " .. method .. ": " .. tostring(currentTitle[method](currentTitle, "Template")) -- "Template" is used to prevent errors when the namespace methods are called. end return resultend
return p