Skip to content

Commit

Permalink
(#62) Add version information to metatool namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
SX committed Dec 7, 2020
1 parent 54d27e7 commit e1bfb7c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion metatool/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,28 @@

-- initialize namespace and core functions
metatool = {
version_str = "2.0.0",
version = nil,
configuration_file = minetest.get_worldpath() .. '/metatool.cfg',
export_default_config = minetest.settings:get_bool("metatool_export_default_config", true),
modpath = minetest.get_modpath('metatool'),
S = string.format
}

local version_matcher = metatool.version_str:gmatch("%d+")
metatool.version = {
major = tonumber(version_matcher()),
minor = tonumber(version_matcher()),
patch = tonumber(version_matcher()),
}
assert(type(metatool.version.major) == "number", "Invalid Metatool version_str major")
assert(type(metatool.version.minor) == "number", "Invalid Metatool version_str minor")
assert(type(metatool.version.patch) == "number", "Invalid Metatool version_str patch")

dofile(metatool.modpath .. '/util.lua')
dofile(metatool.modpath .. '/settings.lua')
dofile(metatool.modpath .. '/api.lua')
dofile(metatool.modpath .. '/command.lua')
dofile(metatool.modpath .. '/formspec.lua')

print('[OK] MetaTool loaded')
print('[OK] MetaTool ' .. metatool.version_str .. ' loaded')

0 comments on commit e1bfb7c

Please sign in to comment.