Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:TagParser: Difference between revisions

From Teriock
Content deleted Content added
// via Wikitext Extension for VSCode
(No difference)

Revision as of 19:05, 12 August 2025

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

local U = {}

local function trim(s) return (mw.text.trim(s or '')) end

-- Split "undead;; animal;; monstrous;;" into { 'undead', 'animal', 'monstrous' }
function U.parseList(s)
	if not s or s == '' then return {} end
	local out = {}
	for _, piece in ipairs(mw.text.split(s, ';;', true)) do
		local v = mw.ustring.lower(trim(piece))
		if v ~= '' then table.insert(out, v) end
	end
	return out
end

return U