Module:linkeach: Difference between revisions

From Linguifex
Jump to navigation Jump to search
(Created page with "local export = {} function export.link(frame) local args = frame.args local str = args[1] local words = mw.text.split(str, " ") for _, word in ipairs(words) do word...")
 
No edit summary
Line 4: Line 4:
local args = frame.args
local args = frame.args
local str = args[1]
local str = args[1]; local words = {}
local words = mw.text.split(str, " ")
for _, word in ipairs(words) do
for word in mw.ustring.gmatch(str, "(%S+)") do
word = "[[Contionary:" .. word .. "|" .. word .. "]]"
word = "[[Contionary:" .. word .. "|" .. word .. "]]"
table.insert(words, word)
end
end

Revision as of 15:16, 12 February 2021



local export = {}

function export.link(frame)
	
	local args = frame.args
	local str = args[1]; local words = {}
	
	for word in mw.ustring.gmatch(str, "(%S+)") do
		word = "[[Contionary:" .. word .. "|" .. word .. "]]"
		table.insert(words, word)
	end
	
	return table.concat(words, " ")
end
return export