Fix version number check

This commit is contained in:
Jean-Patrick Guerrero 2019-09-29 21:03:15 +02:00
parent e2134e479e
commit a50a99836a
1 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,10 @@
craftguide = {} craftguide = {}
local CORE_VERSION = core.get_version().string local p = 0
CORE_VERSION = CORE_VERSION:match("[^%-]*"):gsub("%.", "") local CORE_VERSION = core.get_version().string:match("[^%-]*"):gsub("%.", function(a)
p = p + 1
return p == 3 and a or ""
end)
CORE_VERSION = tonumber(CORE_VERSION) CORE_VERSION = tonumber(CORE_VERSION)
-- Caches -- Caches
@ -40,8 +43,7 @@ local on_receive_fields = core.register_on_player_receive_fields
local ESC = core.formspec_escape local ESC = core.formspec_escape
local S = CORE_VERSION >= 500 and core.get_translator("craftguide") or local S = CORE_VERSION >= 500 and core.get_translator("craftguide") or
function(...) function(...)
local args = {...} local args, i = {...}, 1
local i = 1
return args[1]:gsub("@%d+", function() return args[1]:gsub("@%d+", function()
i = i + 1 i = i + 1