mod utilities by theFox

Providing some utilities that can be used by other mods.


A utility mod for minetetest providing useful utilities that can be used in other mods.


There are several modules in the mod. These can be loaded on demand. To load a module use:

local your_variable = modutil.require("modulename")

The variable then contains the return value of the module. That will in most cases be a table or a function.


A module for creating shorter logging functions.
The loggers will format the given log message and call minetest.log.
Typically you want to use it as following:

my_mod.log = modutil.require("log").make_loggers()
my_mod.log.action("loggers loaded")

You can also pass the level of the loggers to the make_loggers function:

my_mod.log = modutil.require("log").make_loggers("action","warning","error","debug")

If you create your logger after loading the mod you may want to pass the modname using: = modutil.require("log").make_logger("info","my_mod")


A wrapper that checks if minetest.get_translator is avalible and replaces it if nessecary.
The module returns a fucntion that when called returns the translator. use:

my_mod.S = modutil.require("translations")()
-- or for after loading
my_mod.S = modutil.require("translations")("my_mod")


A function doing the same as the standard minetest prefix check. It will assume the modname is correct if it called after loading. use:

local check_prefix = modutil.require("check_prefix")
-- checks if name is in the format "modname:name" or ":modname:name"
-- if modname in "modname:name" is not the currently loaded mod it creates an error
-- returns id in the format "modname:name"
local id = check_prefix(name)