Module:String

From HorizonXI Wiki
Revision as of 08:00, 1 September 2025 by Kaimoon0 (talk | contribs) (module for general string functions (starting with "join"))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:String/doc

--[[

A module for general string functions.

]]

local str = {}

--[[
join

Using the first argument as a separator, join the remaining arguments together.
Example:
{{#invoke:String|join|,|apples|bananas|cherries}}
]]

function str.join(frame)
	local separator = frame.args[1]
	local parts = {}

	for k, v in ipairs(frame.args) do
		if k > 1 then
			table.insert(parts, v)
		end
	end

	return table.concat(parts, separator)
end