Module:LangVars: Difference between revisions
From Vintage Story Wiki
mNo edit summary |
mNo edit summary |
||
Line 11: | Line 11: | ||
local out, img = s | local out, img = s | ||
--Tools and tool heads | |||
for i,v in pairs(langVars.toolTypes) do | for i,v in pairs(langVars.toolTypes) do | ||
if str:match(string.lower(v | if str:match(string.lower(v)) then | ||
out = s | out = s | ||
img = 'Iron ' .. str | img = 'Iron ' .. str | ||
end | end | ||
end | end | ||
--Metal plates | --Metal plates | ||
if string.lower(str):find(string.lower(langVars.itemMetalPlate)) then | if string.lower(str):find(string.lower(langVars.itemMetalPlate)) then |
Latest revision as of 04:06, 23 August 2022
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