Support for love2d 11.1
This commit is contained in:
parent
c069a981cd
commit
0f134f7465
@ -41,6 +41,10 @@ true
|
||||
table: 0x001e3f40
|
||||
```
|
||||
#Updates/Changes
|
||||
Version 5.0.7
|
||||
Added:
|
||||
+ bin.fileExists(name)
|
||||
[returns true if a file exists]
|
||||
Version 5.0.6
|
||||
-------------
|
||||
Fixed a bunch of bugs and added double support to the library
|
||||
|
||||
22
bin/init.lua
22
bin/init.lua
@ -1,5 +1,5 @@
|
||||
bin={}
|
||||
bin.Version={5,1,0}
|
||||
bin.Version={5,2,0}
|
||||
bin.stage='stable'
|
||||
bin.data=''
|
||||
bin.t='bin'
|
||||
@ -684,10 +684,30 @@ if love then
|
||||
temp.filepath=file
|
||||
return temp
|
||||
end
|
||||
function bin.fileExists(name)
|
||||
return love.filesystem.getInfo(name)
|
||||
end
|
||||
function bin:tofile(filename)
|
||||
if not(filename) or self.Stream then return nil end
|
||||
love.filesystem.write(filename,self.data)
|
||||
end
|
||||
function bin.loadS(path,s,r)
|
||||
local path = love.filesystem.getSaveDirectory( ).."\\"..path
|
||||
if type(path) ~= "string" then error("Path must be a string!") end
|
||||
local f = io.open(path, 'rb')
|
||||
local content = f:read('*a')
|
||||
f:close()
|
||||
return bin.new(content)
|
||||
end
|
||||
function bin:tofileS(filename)
|
||||
if self.stream then return end
|
||||
local filename = love.filesystem.getSaveDirectory( ).."\\"..filename
|
||||
print(#self.data,filename)
|
||||
if not filename then error("Must include a filename to save as!") end
|
||||
file = io.open(filename, "wb")
|
||||
file:write(self.data)
|
||||
file:close()
|
||||
end
|
||||
function bin.stream(file)
|
||||
return bin.newStreamFileObject(love.filesystem.newFile(file))
|
||||
end
|
||||
|
||||
@ -70,6 +70,10 @@ function io.dirExists(strFolderName)
|
||||
end
|
||||
end
|
||||
end
|
||||
function bin.fileExists(name)
|
||||
local f=io.open(name,"r")
|
||||
if f~=nil then io.close(f) return true else return false end
|
||||
end
|
||||
function bin.randomName(n,ext)
|
||||
n=n or math.random(7,15)
|
||||
if ext then
|
||||
|
||||
@ -1,6 +1,2 @@
|
||||
package.path="?/init.lua;"..package.path
|
||||
require("bin")
|
||||
--~ test=bin.load("test.dat")
|
||||
--~ print(test:getBlock("n",4))
|
||||
--~ print(test:getBlock("n",4))
|
||||
--~ tab=test:getBlock("t")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user