aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlockhead <jbis1337@hotmail.com>2021-01-18 15:27:50 +0100
committerorwell96 <orwell@bleipb.de>2021-01-18 15:27:50 +0100
commitcdad238183e4aa62df16b2367321abf0f7a517c8 (patch)
treea997575562a110062730fedee783572ef4bd9374
parented165e1b1784f4fed38bb69441051c1ce6b137c8 (diff)
downloadadvtrains-cdad238183e4aa62df16b2367321abf0f7a517c8.tar.gz
advtrains-cdad238183e4aa62df16b2367321abf0f7a517c8.tar.bz2
advtrains-cdad238183e4aa62df16b2367321abf0f7a517c8.zip
Fix serialisation: breach of contract, file left open
Previous commit did not fix saving, but is kept because there is a corner case for which it is required (see MT forum)
-rw-r--r--serialize.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/serialize.lua b/serialize.lua
index a525e9e..12a26c4 100644
--- a/serialize.lua
+++ b/serialize.lua
@@ -190,6 +190,7 @@ local function write_to_fd(root_table, file, config)
file:write("LUA_SER v=1\n")
write_table(root_table, file, config)
file:write("E\nEND_SER\n")
+ file:close()
end
-- Reads the file contents from the passed file descriptor and returns the table on success