dev

See Global Lua Modules/StringConcat

Subpages

--- StringConcat is a simple wrapper for the `table.concat` of lua language.
-- Visit the [[Module_talk:StringConcat/testcases|testcases]] for usage.
-- @module concat
-- @release stable
-- @author [[User:Leslie1289|Leslie1289]]

local concat = {}

local arguments = require('Dev:Arguments')

function concat.main( frame )
	local args = arguments.getArgs(frame)
	local words = {}
	local separator = args.separator
	local skip = args.skip
	for i, word in ipairs(args) do
		if separator == nil and i == 1 then
			separator = word
		elseif word ~= skip then
			table.insert(words, word)
		end
	end
	return table.concat(words, separator)
end

return concat