Difference between revisions of "Module:Icon"

Jump to navigation Jump to search
63 bytes added ,  19:38, 23 October 2021
no edit summary
Line 14: Line 14:
return object
return object
end
function exists(object)
if object == nil or object == '' then
return false
else
return true
end
end
end


local function _requirements(resource, value, link, text)
local function _requirements(resource, value, link, text)
resource = string.lower(trim(resource))
resource = string.lower(trim(resource))
resource = iconList[resource]
value = trim(value)
value = trim(value)
if iconList[resource] ~= nil then
result = '[[file:' .. iconList[resource]['file'] .. '|16px|link='
if resource ~= nil then
if link ~= nil and link ~= '' then
-- Init link here, will be nil if resource is nil
result = result .. link
if exists(link) == false then
else
link = resource['link']
result = result .. iconList[resource]['link']
end
end
result = '[[file:' .. resource['file'] .. '|16px|link='
result = result .. link
result = result .. ']]'
result = result .. ']]'
if text ~= '' and text ~= nil then
if exists(text) == true then
if string.lower(text) ~= 'no' then
if string.lower(text) ~= 'no' then
result = result .. '[['
result = result .. '[['
if link ~= nil and link ~= '' then
result = result .. link
result = result .. link
result = result .. resource['link']
else
result = result .. iconList[resource]['link']
end
result = result .. ']]'
result = result .. ']]'
end
end
end
end
if value ~= nil and value ~= '' then
if exists(value) == true then
result = result .. ' (' .. value .. ')'
result = result .. ' (' .. value .. ')'
end
end

Navigation menu