• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Difference between revisions of "Module:EquipmentAsset"

From Kancolle Wiki
Jump to navigation Jump to search
Line 6: Line 6:
 
function EquipmentAsset:create_object(args)
 
function EquipmentAsset:create_object(args)
 
     if args.id then
 
     if args.id then
         local equipmentMap = require('Module:Collection/EquipmentByApiId')
+
         local equipmentMap = mw.loadData('Module:Collection/EquipmentByApiId')
 
         local apiId = tonumber(args.id)
 
         local apiId = tonumber(args.id)
 
         return Equipment(equipmentMap[apiId])
 
         return Equipment(equipmentMap[apiId])

Revision as of 23:29, 30 September 2020

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

local BaseAsset = require('Module:BaseAsset')
local Equipment = require('Module:Equipment')

local EquipmentAsset = BaseAsset()

function EquipmentAsset:create_object(args)
    if args.id then
        local equipmentMap = mw.loadData('Module:Collection/EquipmentByApiId')
        local apiId = tonumber(args.id)
        return Equipment(equipmentMap[apiId])
    else
	    return Equipment(args[1])
    end
end

return EquipmentAsset