Module:Cmap: Difference between revisions

From Heroes 3 wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:


function p.cmap(frame)
function p.cmap(frame)
return frame.args.input
if frame.args.cmap then
return frame.args.cmap
end
return ''
end
end

Revision as of 18:57, 6 January 2024

Returns arg1 with all instances of arg2 replaced with arg3.

Example

{{#invoke:cmap|cmap|needle in haystack|needle|hay}}
Script error: The module returned a nil value. It is supposed to return an export table.

local p = {} --p stands for package

function p.cmap(frame)
	if frame.args.cmap then
		return frame.args.cmap
	end
	return ''
end