summaryrefslogtreecommitdiff
path: root/server/src/utility/io.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/utility/io.lua')
-rw-r--r--server/src/utility/io.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/server/src/utility/io.lua b/server/src/utility/io.lua
new file mode 100644
index 00000000..73c65237
--- /dev/null
+++ b/server/src/utility/io.lua
@@ -0,0 +1,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