From 4bb361fd460480795973f3a0f414754cf403c0c0 Mon Sep 17 00:00:00 2001 From: Rivulet Date: Sun, 5 Apr 2026 02:02:55 +0000 Subject: [PATCH] Update remotedbserver.lua --- remotedbserver.lua | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/remotedbserver.lua b/remotedbserver.lua index f275912..288820f 100644 --- a/remotedbserver.lua +++ b/remotedbserver.lua @@ -1,21 +1,16 @@ -if not fs.exists("data.db") then - local file = fs.open("data.db", "w") - file.write("{}") - file.close() -end -local file = fs.open("data.db","r+") local eplib = require("entrypointlib") -if not file then error("failed to open db file") end local function readTable() - file.seek("set") + local file = fs.open("data.db","r") + if not file then error("failed to open db file") end return textutils.unserialise(file.readAll() or "{}") or {} end local function writeTable(t) - file.seek("set") + local file = fs.open("data.db", "w") + if not file then error("failed to open db file") end file.write(textutils.serialise(t)) - file.flush() + file.close() end local function receive()