aboutsummaryrefslogtreecommitdiff
path: root/serialize_lib/serialize.lua
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
commitb4c8de8695a53fc3348dffe93f40683cb6d63fa7 (patch)
tree93626dae1fc100b3aad19509f37c5a2317663071 /serialize_lib/serialize.lua
parent7fa1a402bf098fa21fc0d32899885d1203e441b6 (diff)
downloadadvtrains-b4c8de8695a53fc3348dffe93f40683cb6d63fa7.tar.gz
advtrains-b4c8de8695a53fc3348dffe93f40683cb6d63fa7.tar.bz2
advtrains-b4c8de8695a53fc3348dffe93f40683cb6d63fa7.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)
Diffstat (limited to 'serialize_lib/serialize.lua')
-rw-r--r--serialize_lib/serialize.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/serialize_lib/serialize.lua b/serialize_lib/serialize.lua
index a525e9e..12a26c4 100644
--- a/serialize_lib/serialize.lua
+++ b/serialize_lib/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