minetest.get_modpath

From Minetest Developer Wiki
(Redirected from get modpath)
Jump to: navigation, search

Syntax

Description

Returns root mod directory location. Useful for loading additional .lua modules or static data from mod.
For not installed mods, this function returns nil. Therefor it can be used to determine whether an optionally depended mod is installed.

Example

local modname = minetest.get_current_modname()
local path = minetest.get_modpath(modname)
 
minetest.log("action", "[MOD]"..modname.." -- loaded from "..path)
 
dofile(path .. DIR_DELIM .. "another_file.lua") -- (DIR_DELIM is a builtin variable)
 
if minetest.get_modpath("some_optional_depend_mod") then
	some_function_from_that_mod("foo")
end
Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox