Module:IL/archived

From Fallen London Wiki (Staging)

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

local p = {}

local image_data = mw.loadData('Module:IL/images')
local prefix_data = mw.loadData('Module:IL/prefixes')

function p.main(frame)
	local quality_item_name = frame.args[1] or frame:getParent().args[1]
	local no_default = frame.args["nodef"] or frame:getParent().args["nodef"]

	quality_item_name = quality_item_name:gsub("^%l", string.upper)
	if image_data[quality_item_name] ~= nil then
	    quality_item_name = image_data[quality_item_name]
	elseif no_default then
	    quality_item_name = ""
	else
	    quality_item_name = "Questionsmall.png"
	end
	return quality_item_name
end

function p.prefix(frame)
	local quality_item_name = frame.args[1] or frame:getParent().args[1]
	quality_item_name = quality_item_name:gsub("^%l", string.upper)
	if prefix_data[quality_item_name] ~= nil then
        quality_item_name = prefix_data[quality_item_name]
	else
	    quality_item_name = ""
	end
	return quality_item_name
end
 
return p