1,124
edits
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 | |||
if resource ~= nil then | |||
if link | -- Init link here, will be nil if resource is nil | ||
if exists(link) == false then | |||
link = resource['link'] | |||
end | end | ||
result = '[[file:' .. resource['file'] .. '|16px|link=' | |||
result = result .. link | |||
result = result .. ']]' | result = result .. ']]' | ||
if text | |||
if exists(text) == true then | |||
if string.lower(text) ~= 'no' then | if string.lower(text) ~= 'no' then | ||
result = result .. '[[' | result = result .. '[[' | ||
result = result .. link | |||
result = result .. resource['link'] | |||
result = result .. ']]' | result = result .. ']]' | ||
end | end | ||
end | end | ||
if value | if exists(value) == true then | ||
result = result .. ' (' .. value .. ')' | result = result .. ' (' .. value .. ')' | ||
end | end |