mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 07:13:45 +01:00
Add file.read_binary for consistency
This commit is contained in:
parent
6d87228f4f
commit
93c1338135
8
file.lua
8
file.lua
@ -32,6 +32,14 @@ function read(filename)
|
|||||||
return content
|
return content
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function read_binary(filename)
|
||||||
|
local file, err = io.open(filename, "rb")
|
||||||
|
if file == nil then return nil, err end
|
||||||
|
local content = file:read"*a"
|
||||||
|
file:close()
|
||||||
|
return content
|
||||||
|
end
|
||||||
|
|
||||||
function write_unsafe(filename, new_content)
|
function write_unsafe(filename, new_content)
|
||||||
local file, err = io.open(filename, "w")
|
local file, err = io.open(filename, "w")
|
||||||
if file == nil then return false, err end
|
if file == nil then return false, err end
|
||||||
|
Loading…
Reference in New Issue
Block a user