diff options
author | orwell96 <orwell@bleipb.de> | 2021-05-03 22:06:02 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2021-05-03 22:06:02 +0200 |
commit | 81cd305aa04f7af0bd812c5addb8673d5d633b44 (patch) | |
tree | ace239d39dcdbb1c51b175e5a2fb7c9ff9d1b4e0 /serialize_lib | |
parent | 5aa700c3ab14434e36cabb2ba7c9f053e52730cc (diff) | |
parent | d4593491efbcab47efd918d7918b97b4621828b3 (diff) | |
download | advtrains-81cd305aa04f7af0bd812c5addb8673d5d633b44.tar.gz advtrains-81cd305aa04f7af0bd812c5addb8673d5d633b44.tar.bz2 advtrains-81cd305aa04f7af0bd812c5addb8673d5d633b44.zip |
Merge commit 'd4593491efbcab47efd918d7918b97b4621828b3'
Diffstat (limited to 'serialize_lib')
-rw-r--r-- | serialize_lib/atomic.lua | 2 | ||||
-rw-r--r-- | serialize_lib/serialize.lua | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/serialize_lib/atomic.lua b/serialize_lib/atomic.lua index 4a48c27..886b6a4 100644 --- a/serialize_lib/atomic.lua +++ b/serialize_lib/atomic.lua @@ -107,7 +107,7 @@ function serialize_lib.load_atomic(filename, callback) end end - if minetest.settings:get_bool("serialize_lib_strict_loading") then + if minetest.settings:get_bool("serialize_lib_strict_loading", true) then serialize_lib.save_lock = true error("Loading data from file '"..filename.."' failed:\n" ..ret.."\nDisable Strict Loading to ignore.") diff --git a/serialize_lib/serialize.lua b/serialize_lib/serialize.lua index 4b1ebb7..78ddcfd 100644 --- a/serialize_lib/serialize.lua +++ b/serialize_lib/serialize.lua @@ -117,6 +117,8 @@ function read_table(t, file) file:close() error("Unexpected EOF or read error!") end + -- possibly windows fix: strip trailing \r's from line + line = string.gsub(line, "\r$", "") if line=="E" then -- done with this table @@ -203,6 +205,8 @@ end -- config: see above local function read_from_fd(file) local first_line = file:read("*line") + -- possibly windows fix: strip trailing \r's from line + first_line = string.gsub(first_line, "\r$", "") if not string.match(first_line, "LUA_SER v=[12]") then file:close() error("Expected header, got '"..first_line.."' instead!") @@ -210,6 +214,8 @@ local function read_from_fd(file) local t = {} read_table(t, file) local last_line = file:read("*line") + -- possibly windows fix: strip trailing \r's from line + last_line = string.gsub(last_line, "\r$", "") file:close() if last_line ~= "END_SER" then error("Missing END_SER, got '"..last_line.."' instead!") |