Module init.lua

📑 Source

Luanti init.lua for luanti_utils.

Defines a global named luanti_utils with the following:

Functions


# luanti_utils.dofile (module)
Load a Lua file from the current mod directory.

This is a wrapper around dofile that automatically prepends the mod's path, so you can load other files in your mod without specifying the full path manually.

Parameters

  • module string The filename of the Lua module to load (relative to the luanti_utils directory)

Returns

    any The return value of the loaded module

Usage:

    local extend_item = luanti_utils.dofile("extend_item.lua")
    local extend_group = luanti_utils.dofile("extend_group.lua")

# luanti_utils.nocache ()
A function that is called in luanti_util modules that should not cache.

By default luanti_utils modules are cached which is unusual for a dofile but a pretty handy default when writing modules. For the user of luanti_utils it does not matter. Only for luanti_utils developers it's important to know. See also

Tables


# luanti_utils
The global luanti_utils table.