Mobius Final Fantasy Wiki
m
m (forgot "string.")
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
local p = {}
 
local p = {}
 
local getArgs = require("Module:Arguments").getArgs
 
local util = require( 'Module:Utils' )
 
   
 
function p.main( frame )
 
function p.main( frame )
local element = frame.args[1]
+
local args = getArgs(frame, {
  +
wrappers = "Template:Orb"
local size = frame.args[2] or "20px"
 
  +
})
local text = util.startMaj( element )
 
  +
return p._main(args)
local color = ""
 
  +
end
local orb = "[[File:" .. element .. "_Icon.png|link=|" .. size .. "]]"
 
  +
function p._main( args )
if frame.args.color then color = element end
 
 
local element = string.lower(args[1] or "")
if frame.args.text then
 
  +
local size = tonumber(args.size) or 20
orb = orb .. " " .. util.colorText( text, color )
 
 
local icon, name
  +
  +
if element == "fire" then
  +
icon = "Fire Icon.png"
  +
name = "[FIRE]"
  +
elseif element == "water" then
  +
icon = "Water Icon.png"
  +
name = "[WATER]"
  +
elseif element == "wind" then
  +
icon = "Wind Icon.png"
  +
name = "[WIND]"
  +
elseif element == "earth" then
  +
icon = "Earth Icon.png"
  +
name = "[EARTH]"
  +
elseif element == "light" then
  +
icon = "Light Icon.png"
  +
name = "[LIGHT]"
  +
elseif element == "dark" then
  +
icon = "Dark Icon.png"
  +
name = "[DARK]"
  +
elseif element == "restoration" or element == "life" then
  +
icon = "Life Icon.png"
  +
name = "[LIFE]"
  +
elseif element == "prismatic" then
  +
icon = "Prismatic Icon.png"
  +
name = "[PRISMATIC]"
  +
elseif element == "none" then
  +
icon = "None Icon.png"
  +
name = "[NONE]"
  +
else
 
return ""
 
end
 
end
  +
local fmt = "[[File:%s|link=|%spx|%s]]"
return orb
 
  +
return string.format(fmt, icon, size, name)
 
end
 
end
   

Latest revision as of 14:13, 1 June 2018


local p = {}
local getArgs = require("Module:Arguments").getArgs

function p.main( frame )
	local args = getArgs(frame, {
		wrappers = "Template:Orb"
	})
	return p._main(args)
end
function p._main( args )
	local element = string.lower(args[1] or "")
	local size = tonumber(args.size) or 20
	local icon, name
	
	if element == "fire" then
		icon = "Fire Icon.png"
		name = "[FIRE]"
	elseif element == "water" then
		icon = "Water Icon.png"
		name = "[WATER]"
	elseif element == "wind" then
		icon = "Wind Icon.png"
		name = "[WIND]"
	elseif element == "earth" then
		icon = "Earth Icon.png"
		name = "[EARTH]"
	elseif element == "light" then
		icon = "Light Icon.png"
		name = "[LIGHT]"
	elseif element == "dark" then
		icon = "Dark Icon.png"
		name = "[DARK]"
	elseif element == "restoration" or element == "life" then
		icon = "Life Icon.png"
		name = "[LIFE]"
	elseif element == "prismatic" then
		icon = "Prismatic Icon.png"
		name = "[PRISMATIC]"
	elseif element == "none" then
		icon = "None Icon.png"
		name = "[NONE]"
	else
		return ""
	end
	local fmt = "[[File:%s|link=|%spx|%s]]"
	return string.format(fmt, icon, size, name)
end

return p