Jump to content

Module:CodeToText

Revision as of 17:57, 7 February 2025 by MarkWD (talk | contribs) (Created page with "local p = {} function p.test(frame) local pageName = frame.args.page or 'Module:Sandbox' local titleObj = mw.title.new(pageName) if not titleObj then return "Failed to create mw.title object for '" .. pageName .. "'" end local content = titleObj:getContent() if not content then return "No content for '" .. pageName .. "'" end return content end return p")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}

function p.test(frame)
    local pageName = frame.args.page or 'Module:Sandbox'
    local titleObj = mw.title.new(pageName)
    if not titleObj then
        return "Failed to create mw.title object for '" .. pageName .. "'"
    end

    local content = titleObj:getContent()
    if not content then
        return "No content for '" .. pageName .. "'"
    end

    return content
end

return p