Module:Sandbox/Ahecht/flag

This is an old revision of this page, as edited by Ahecht (talk | contribs) at 03:49, 12 June 2020 (frame:getParent().args.alias). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}
	
function p.main(frame)
	if ( (frame.args.alias or frame:getParent().args.alias or "") ~= "" ) then
		output = {}
	
		for k,v in pairs(frame.args) do
			if (v or '') ~= '' then
				output[#output+1] = '\t["' .. k .. '"] = ' .. v
			end
		end
	
		for k,v in pairs(frame:getParent().args) do
			if (v or '') ~= '' then
				output[#output+1] = '\t["' .. k .. '"] = ' .. v
			end
		end
		
		return '["' .. (frame.args.alias or frame:getParent().args.alias) .. '"] = {\n' .. table.concat(output,",\n") .. '\n},\n'
	else
		return ""
	end
end

return p