Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Test

From ProleWiki, the proletarian encyclopedia
Revision as of 19:16, 14 April 2024 by Forte (talk | contribs) (Added comments)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
local p = {}
function p.test( frame )
	-- Get contents of page
	local pageContent = tostring(mw.title.getCurrentTitle():getContent())
	-- Split contents of page in lines
	local pageLines = mw.text.split(pageContent,'\n',true)
	local render = ''
	for i=1,#pageLines do
		-- Get every line starting with '==', that is, a header
		if mw.text.split(pageLines[i], '%s')[1] == '==' then
			render = render .. pageLines[i]
		end
	end
	return render
end
return p