Module:ASBInput

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Revision as of 05:21, 26 February 2024 by KojoB (talk | contribs) (Created page with "local p = {} -- note this function isn't designed to be used in other modules w/out modification function file(name, size) return "" .. size .. "|link=" end -- retrieve input image associations local inputFiles = mw.loadData("Module:ASBInput/Input File Data") function p.main(frame) local final = "" for i, val in ipairs(frame.args) do if i ~= 1 then final = final .. " + " end -- convert presets (could make this a Lua table ins...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

local p = {}

-- note this function isn't designed to be used in other modules w/out modification
function file(name, size)
	return "[[File:" .. name .. "|" .. size .. "|link=]]"	
end

-- retrieve input image associations
local inputFiles = mw.loadData("Module:ASBInput/Input File Data")

function p.main(frame)
	local final = ""
	
	for i, val in ipairs(frame.args) do
		if i ~= 1 then 
			final = final .. " + "
		end
		
		-- convert presets (could make this a Lua table instead at some point)
		if val == "ATK" then
			input = "L/M/H"
		else 
			input = val
		end
		
		-- loop through input symbols
		for i = 1, string.len(input), 1 do
			char = string.sub(input, i, i)
			final = final .. ( file(inputFiles[char], "25px") or char or "" )
		end
	end
	
	return final
end