changed structure

This commit is contained in:
kin fuyuki 2026-02-17 02:28:24 -03:00
commit e4b517b1b3
No known key found for this signature in database
GPG key ID: 0E4E8E519FB71401
2 changed files with 0 additions and 0 deletions

View file

@ -1,93 +0,0 @@
--tiny lua class
local tdf = require("tdf")
local filemt = {}
function filemt:close()
tdf.close(self.handle)
end
function filemt:save()
tdf.save(self.handle)
end
function filemt:defined(path)
return tdf.defined(self.handle, unpack(path))
end
function filemt:getint(path)
return tdf.getint(self.handle, unpack(path))
end
function filemt:getfloat(path)
return tdf.getfloat(self.handle, unpack(path))
end
function filemt:getstring(path)
return tdf.getstring(self.handle, unpack(path))
end
function filemt:getbool(path)
return tdf.getbool(self.handle, unpack(path))
end
function filemt:getchar(path)
local c = tdf.getchar(self.handle, unpack(path))
return string.byte(c)
end
function filemt:getpointer(path)
return {tdf.getpointer(self.handle, unpack(path))}
end
function filemt:getclass(path)
return tdf.getclass(self.handle, unpack(path))
end
function filemt:setint(path, value)
tdf.setint(self.handle, unpack(path), value)
end
function filemt:setfloat(path, value)
tdf.setfloat(self.handle, unpack(path), value)
end
function filemt:setstring(path, value)
tdf.setstring(self.handle, unpack(path), value)
end
function filemt:setblock(path, value)
tdf.setblock(self.handle, unpack(path), value)
end
function filemt:setbool(path, value)
tdf.setbool(self.handle, unpack(path), value)
end
function filemt:setchar(path, value)
tdf.setchar(self.handle, unpack(path), string.char(value))
end
function filemt:setpointer(path, tbl)
tdf.setpointer(self.handle, unpack(path), unpack(tbl))
end
function filemt:define(names, classname)
tdf.define(self.handle, names, classname)
end
local function open(filepath)
local ok, handle = pcall(tdf.read, filepath)
if not ok then
error(handle)
end
local obj = {handle = handle}
setmetatable(obj, {__index = filemt})
return obj
end
return {
open = open
}