summaryrefslogtreecommitdiff
path: root/server/src/utility/io.lua
blob: 73c65237c9a817be1792bb70f48f1fef498393cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function io.load(file_path)
	local f, e = io.open(file_path:string(), 'rb')
	if not f then
		return nil, e
	end
	local buf = f:read 'a'
	f:close()
	return buf
end

function io.save(file_path, content)
	local f, e = io.open(file_path:string(), "wb")

	if f then
		f:write(content)
		f:close()
		return true
	else
		return false, e
	end
end