Module:Item: Difference between revisions

From EarthMC
Jump to navigation Jump to search
(Created page with "local fileModule = require("Module:FileExists") local function capitalizeFirstLetter(input) local firstLetter = input:sub(1, 1) local restOfString = input:sub(2) return firstLetter:upper() .. restOfString:lower() end function p.getItemNameAndIMG( frame ) local arg = string.lower(frame.args[1]) local fileExists = fileModule.fileExists("File:"..arg) if fileExists then return "File:"..arg.."|25px]] "..capitalizeFirstLetter(arg) end return capitalizeFirstLette...")
 
m (515797455988850689 moved page Module:ItemIMG to Module:Item without leaving a redirect)
(No difference)

Revision as of 14:31, 21 October 2023

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

local fileModule = require("Module:FileExists")

local function capitalizeFirstLetter(input)
	local firstLetter = input:sub(1, 1)
	local restOfString = input:sub(2)
	return firstLetter:upper() .. restOfString:lower()
end

function p.getItemNameAndIMG( frame )
    local arg = string.lower(frame.args[1])
	local fileExists = fileModule.fileExists("File:"..arg)
	if fileExists then
		return "File:"..arg.."|25px]] "..capitalizeFirstLetter(arg)
	end
	return capitalizeFirstLetter(arg)
end