Diaeresis cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago
..
.github cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago
.cdb.json cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago
.editorconfig cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago
.luacheckrc cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago
.pre-commit-config.yaml cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago
LICENSE.txt cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago
README.md cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago
build_has.lua cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago
get_settings.lua cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago
init.lua cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago
mod.conf cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago
parse_version.lua cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago
screenshot.png cd2d00a96e Add 'mods/fmod/' from commit 'b338fafcbcd14055418923be7372aba23505e1ff' 1 year ago

README.md

fmod

flux's mod boilerplate

public API

  • modname = fmod.create(fork)

creates the boilerplate i use in all my mods, so i don't have to worry about keeping them all up-to-date when i tweak things.

fork is an optional parameter for other people to use if they fork a mod.

the api which is created looks like

modname = {
		modname = modname,
		modpath = modpath,
		title = mod_conf:get("title") or modname,
		description = mod_conf:get("description"),
		author = mod_conf:get("author"),
		license = mod_conf:get("license"),
		version = mod_conf:get("version"),
		fork = fork or "flux",

		S = S,

		has = build_has(mod_conf),

		check_version = function(required)
			assert(mod_conf:get("version") >= required, f("%s requires a newer version of %s; please update it", minetest.get_current_modname(), modname))
		end,

		log = function(level, messagefmt, ...)
			return minetest.log(level, f("[%s] %s", modname, f(messagefmt, ...)))
		end,

		dofile = function(...)
			return dofile(table.concat({modpath, ...}, DIR_DELIM) .. ".lua")
		end,
}