From 471af9b080b5cb086ea21924a0304d54e777ee52 Mon Sep 17 00:00:00 2001 From: JP Guerrero Date: Fri, 9 Mar 2018 00:24:00 +0100 Subject: [PATCH] Add version control --- init.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/init.lua b/init.lua index bc05030..6509446 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,18 @@ --local t = os.clock() + +local mver_major, mver_minor, mver_patch = 0, 4, 16 -- Minetest 0.4.16 minimum. + +local client_version = minetest.get_version().string +local major, minor, patch = client_version:match("(%d+).(%d+).(%d+)") + +if (major and minor and patch) and + ((tonumber(major) < mver_major) or + (mver_major == tonumber(major) and tonumber(minor) < mver_minor) or + (mver_minor == tonumber(minor) and tonumber(patch) < mver_patch)) then + minetest.log("error", "[xdecor] Your Minetest client is too old to run this mod. Disabling.") + return +end + xdecor = {} local modpath = minetest.get_modpath("xdecor")