Jump to content

Module:Sandbox/RexxS: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
show name
category ns
Line 6: Line 6:
function p.cats(frame)
function p.cats(frame)
local title = frame.args.title
local title = frame.args.title
local ttlobj = mw.title.new( title, 0 )
local ttlobj = mw.title.new( title, 14 )
local cont = ttlobj:getContent()
local cont = ttlobj:getContent()
if cont then return cont:sub(1,10) end
if cont then return cont:sub( 1, 100 ) end
end
end



Revision as of 17:40, 7 January 2020

-- This is here as a placeholder.
-- It is to demonstrate to Google-Code-in students what the module sandbox is.

local p = {}

function p.cats(frame)
	local title = frame.args.title
	local ttlobj = mw.title.new( title, 14 )
	local cont = ttlobj:getContent()
	if cont then return cont:sub( 1, 100 ) end
end

function p.namespaces(frame)
	local ns = mw.site.namespaces
	local msg = ""
	for k, v in pairs(ns) do
		msg = msg .. k .. " = " .. v.name .. "<br>"
	end
	return msg
end

return p