Module:LangVars

From Vintage Story Wiki
Revision as of 04:06, 23 August 2022 by Sana (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}

local langVars = {}
function p.processLang(code)
	langVars = require( 'Module:LangVars/' .. code ).i18n
	return langVars
end

function p.link(s)
	local str = string.lower(s)
	local out, img = s
	
	--Tools and tool heads
	for i,v in pairs(langVars.toolTypes) do
		if str:match(string.lower(v)) then 
			out = s
			img = 'Iron ' .. str
		end
	end
	
	
	--Metal plates
	if string.lower(str):find(string.lower(langVars.itemMetalPlate)) then 
		out = langVars.itemMetalPlate 
		img = 'Iron plate' 
	end
	--Lanterns
	if string.lower(str):find(string.lower(langVars.itemLantern)) then 
		out = langVars.itemLantern 
		img = 'Iron lantern'
	end
	
	return out, img
end

return p