Terraria Wiki
Advertisement

Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:Localization/opis

local ugsub = mw.ustring.gsub

------------------------------
return {
	-- replace all tokens in source string with replacement
	replace = function(frame)
		local str = frame.args['str']
		for token, replace in pairs(frame:getParent().args) do
			if mw.ustring.sub(token, 1, 1) == '$' then
				-- escape, to perform plain text replacement. see Module:String
				str = ugsub(str, (ugsub(token, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1")), (ugsub(replace, "%%", "%%%%" ))) -- () to force return only 1 value.
			end
		end
		return str
	end,

}
Advertisement