fix: do not load datapack if there isn't any

This commit is contained in:
Kazhnuz 2022-08-10 19:15:38 +02:00
parent a315fcebb5
commit 4722b734ed

View file

@ -36,11 +36,13 @@ end
function DataManager:loadDatas() function DataManager:loadDatas()
self.datapacks = {} self.datapacks = {}
if (index.datapack ~= nil) then
for key, datas in pairs(index.datapacks) do for key, datas in pairs(index.datapacks) do
self.core.debug:debug("datamanager", "loading data for " .. key) self.core.debug:debug("datamanager", "loading data for " .. key)
self.datapacks[key] = DataPack(datas[1], datas[2], datas[3], datas[4], datas[5]) self.datapacks[key] = DataPack(datas[1], datas[2], datas[3], datas[4], datas[5])
end end
end end
end
function DataManager:get(datapack, name) function DataManager:get(datapack, name)
return self.datapacks[datapack]:get(name) return self.datapacks[datapack]:get(name)