bdd-creature/classes/beastfile.lua

22 lines
512 B
Lua
Raw Normal View History

2024-08-01 23:14:47 +02:00
local BeastFile = Object:extend()
local DataList = require "classes.datalist"
2024-08-01 23:27:21 +02:00
local parseFile = require "libs.filereader"
2024-08-01 23:14:47 +02:00
function BeastFile:new(folder, name)
self.filepath = folder .. "/" .. name
print("Loading " .. self.filepath)
self.datas = DataList()
2024-08-01 23:27:21 +02:00
self:readLines()
end
function BeastFile:readLines()
2024-08-01 23:56:04 +02:00
local lines = parseFile(self.filepath, function (line) self.datas:addLine(line) end)
2024-08-01 23:14:47 +02:00
end
function BeastFile:prepareJson()
return self.datas:prepareJson()
end
return BeastFile