mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2024-11-10 00:45:15 +00:00
19 lines
431 B
Lua
19 lines
431 B
Lua
local U = {}
|
|
|
|
-- https://www.lua.org/manual/5.1/manual.html#5.7
|
|
-- w+: Update mode, all previous data is erased;
|
|
-- b: Binary mode, forces Windows to save with Unix endings.
|
|
MODE_WRITE_ERASE_EXISTING = 'w+b'
|
|
|
|
function U.writeFile(path, data)
|
|
logDebug('writing file: ' .. path)
|
|
|
|
local file, err = io.open(path, MODE_WRITE_ERASE_EXISTING)
|
|
assert(err == nil, err)
|
|
file:write(data)
|
|
file:flush()
|
|
file:close()
|
|
end
|
|
|
|
return U
|