Anonymous

Module:Constants: Difference between revisions

From Melvor Idle
Fix equipment slot functions
(Update for change in structure of equipmentSlots data)
(Fix equipment slot functions)
Line 671: Line 671:


function p.getEquipmentSlotName(id)
function p.getEquipmentSlotName(id)
return GameData.getEntityByID('equipmentSlots', id)
local slotData = GameData.getEntityByID('equipmentSlots', id)
if slotData ~= nil then
return slotData.name
end
end
end


function p.getEquipmentSlotID(name)
function p.getEquipmentSlotID(name)
return GameData.getEntityByName('equipmentSlots', name)
local slotData = GameData.getEntityByName('equipmentSlots', name)
if slotData ~= nil then
return slotData.id
end
end
end