mirror of
https://github.com/appgurueu/modlib.git
synced 2024-12-22 21:32:27 +01:00
Add modlib.file.write_binary
This commit is contained in:
parent
a89ce5bca8
commit
a243d2ae48
8
file.lua
8
file.lua
@ -42,6 +42,14 @@ end
|
||||
|
||||
write = minetest and minetest.safe_file_write or write_unsafe
|
||||
|
||||
function write_binary(filename, new_content)
|
||||
local file = io.open(filename, "wb")
|
||||
if file == nil then return false end
|
||||
file:write(new_content)
|
||||
file:close()
|
||||
return true
|
||||
end
|
||||
|
||||
function ensure_content(filename, ensured_content)
|
||||
local content = read(filename)
|
||||
if content ~= ensured_content then
|
||||
|
Loading…
Reference in New Issue
Block a user