12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- -- No need to explain
- Toml=require("toml")
- local File={}
- function File.reqsubdir(dir)
- return love.filesystem.getDirectoryItems(dir)
- end
- function File.reqlua(dir)
- return love.filesystem.load(dir)
- end
- function File.tostr(file)
- return love.filesystem.read(file)
- end
- function File.fromstr(data,file)
- local lfile=io.open(file,"w")
- lfile:write(data)
- lfile:close()
- end
- function File.dcfromtoml(file)
- return Toml.parse(File.tostr(file),{strict=false})
- end
- function File.ectotoml(data,file)
- -- Can lead to issues, io handle path differently
-
- local lfile=io.open(file,"w")
- lfile:write(Toml.encode(data))
- lfile:close()
- end
- return File
|