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

-- <nowiki>
local FFVIMorph = {}
local getArgs = require('Dev:Arguments').getArgs
local data = mw.loadData("Module:FFVIMorph/data")
local morph = data.morph

function FFVIMorph.main(frame) 
    -- Implements {{#invoke:FFVIMorph|1=platform|2=id|3=slot|equiptype=?item}}
	local args = getArgs(frame, {
	valueFunc = function (key, value)
	    if type(value) == 'string' and mw.ustring.find(value, '%S') then
	        value = mw.text.trim(value)
			return mw.ustring.lower(value)
		else
		    return value
		end
    end
})
	return FFVIMorph.lookup(args)
end
  
function FFVIMorph.lookup(args)
    local platform = args['platform'] or args[1] or nil
    local id = args['id'] or args[2] or nil
    local slot = args['slot'] or args[3] or nil
    local equiptype = args['equiptype'] or 'item'
    assert(platform, "No platform was listed.")
    assert(id, "No id was listed.")
    assert(slot, "No slot was listed.")
    local result = morph[platform][id][slot]
    return result
end

--will probably need a new function that returns all of the slots in one, then formats
return FFVIMorph
-- </nowiki>
Community content is available under CC-BY-SA unless otherwise noted.