Difference between revisions of "Module:Sandbox/Andy M. Wang"

From blackwiki
Jump to navigation Jump to search
blackwiki>Andy M. Wang
m (print?)
blackwiki>Andy M. Wang
m (concat)
Line 17: Line 17:
  
 
function p._for(titleText, ...)
 
function p._for(titleText, ...)
for k, v in pairs(arg) do print(k,v) end
+
local ret = ''
 +
for k, v in pairs(arg) do
 +
ret = ret .. k .. v
 +
end
 +
return ret
 
--local links = mHatnote.formatPages(...)
 
--local links = mHatnote.formatPages(...)
 
--links = mw.text.listToText(links)
 
--links = mw.text.listToText(links)

Revision as of 06:23, 1 May 2016

Template:NOINDEX

A longer-term module sandbox for testing.


local mHatnote = require('Module:Hatnote')
local mArguments -- lazily initialise

local p = {}

function p.forfun(frame)
	mArguments = require('Module:Arguments')
	local args = mArguments.getArgs(frame, {parentOnly = true})
	local pages = {}
	for k, v in pairs(args) do
		if type(k) == 'number' then
			pages[k] = v
		end
	end
	return p._for(mw.title.getCurrentTitle().text, unpack(pages))
end

function p._for(titleText, ...)
	local ret = ''
	for k, v in pairs(arg) do
		ret = ret .. k .. v
	end
	return ret
	--local links = mHatnote.formatPages(...)
	--links = mw.text.listToText(links)
	--local text = 'For ' .. links
	--return mHatnote._hatnote(text)
end

return p