Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit a50a998

Browse files
committed
Fix version number check
1 parent e2134e4 commit a50a998

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

init.lua

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
craftguide = {}
22

3-
local CORE_VERSION = core.get_version().string
4-
CORE_VERSION = CORE_VERSION:match("[^%-]*"):gsub("%.", "")
5-
CORE_VERSION = tonumber(CORE_VERSION)
3+
local p = 0
4+
local CORE_VERSION = core.get_version().string:match("[^%-]*"):gsub("%.", function(a)
5+
p = p + 1
6+
return p == 3 and a or ""
7+
end)
8+
CORE_VERSION = tonumber(CORE_VERSION)
69

710
-- Caches
811
local pdata = {}
@@ -40,8 +43,7 @@ local on_receive_fields = core.register_on_player_receive_fields
4043
local ESC = core.formspec_escape
4144
local S = CORE_VERSION >= 500 and core.get_translator("craftguide") or
4245
function(...)
43-
local args = {...}
44-
local i = 1
46+
local args, i = {...}, 1
4547

4648
return args[1]:gsub("@%d+", function()
4749
i = i + 1

0 commit comments

Comments
 (0)