Module:Sandbox/User:Chen/Sandbox

From Illerai

This is the current revision of this page, as edited by imported>CephHunter at 15:09, 26 December 2022 (Module:Enum -> Module:Array). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Sandbox/User:Chen/Sandbox/doc

--<nowiki>
local Enum = require("Module:Array")
local p = {}

function p.explode(str, delim, index, count)
	return table.concat(Enum.take(mw.text.split(str, delim), count or #str, index or 1), delim)
end

function p.explode_m(frame)
	local args = mw.getCurrentFrame():getParent().args
	return p.explode(args[1], args[2], tonumber(args[3]), tonumber(args[4]))
end

return p

--</nowiki>