Module:Dash: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
No edit summary
ArrowHead294 (talk | contribs)
No edit summary
Line 5: Line 5:
local output = ""
local output = ""
     for wd in input_str:gmatch("%s+") do
     for wd in tostring(input_str):gmatch("%s+") do
     table.insert(words, wd)
     table.insert(words, wd)
end
end

Revision as of 02:40, 12 May 2024

Module documentation[view] [edit] [history] [purge]
This module should not be invoked directly; use its corresponding template instead: Template:Dash.

Replaces comma and space in list with dashes and spaces.

Introspection summary for Module:Dash 
Functions provided (1)
Line Function Params
3 dashes (input_str, spaces, separator)
Lua modules required (0)
Variable Module Functions used

No function descriptions were provided. The Lua code may have further information.


local p = {};

function p.dashes(input_str, spaces, separator)
	words = {}
	local output = ""
	
    for wd in tostring(input_str):gmatch("%s+") do
    	table.insert(words, wd)
	end
	
	for i, v in pairs(words) do
		output = output .. words[i]
		if next(v, i) ~= nil then
		    output = output .. spaces .. separator .. spaces
		end
	end
	
	return output
end

return p