From 42cd70a86237d2acc1d2861bad9f6c18e0e2ee93 Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Mon, 19 Dec 2022 08:23:01 +0100 Subject: [PATCH] file checks --- mtt.lua | 2 +- serialize.lua | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mtt.lua b/mtt.lua index 6a74185..c9070b0 100644 --- a/mtt.lua +++ b/mtt.lua @@ -18,7 +18,7 @@ mtt.register("register and export", function(callback) end) -mtt.register("serlize_chunk", function(callback) +mtt.register("serialize_chunk", function(callback) local pos1 = { x=0, y=0, z=0 } local pos2 = { x=20, y=20, z=20 } diff --git a/serialize.lua b/serialize.lua index b1190c0..54cc5a9 100644 --- a/serialize.lua +++ b/serialize.lua @@ -5,6 +5,10 @@ local char, encode_uint16, insert = string.char, mapsync.encode_uint16, table.in function mapsync.serialize_chunk(chunk_pos, filename) local f = global_env.io.open(filename, "w") + if not f then + return false, "could not open '" .. filename .. "'" + end + local zip = mtzip.zip(f) local blockdata_list = {}