Minetest  5.4.0
LuaSettings Class Reference

#include <l_settings.h>

+ Inheritance diagram for LuaSettings:
+ Collaboration diagram for LuaSettings:

Public Member Functions

 LuaSettings (Settings *settings, const std::string &filename)
 
 LuaSettings (const std::string &filename, bool write_allowed)
 
 ~LuaSettings ()
 

Static Public Member Functions

static void create (lua_State *L, Settings *settings, const std::string &filename)
 
static int create_object (lua_State *L)
 
static LuaSettingscheckobject (lua_State *L, int narg)
 
static void Register (lua_State *L)
 
- Static Public Member Functions inherited from ModApiBase
static ScriptApiBasegetScriptApiBase (lua_State *L)
 
static ServergetServer (lua_State *L)
 
static ServerInventoryManagergetServerInventoryMgr (lua_State *L)
 
static ClientgetClient (lua_State *L)
 
static GUIEnginegetGuiEngine (lua_State *L)
 
static IGameDefgetGameDef (lua_State *L)
 
static EnvironmentgetEnv (lua_State *L)
 
static std::string getCurrentModPath (lua_State *L)
 
template<typename T >
static T * getScriptApi (lua_State *L)
 
static bool registerFunction (lua_State *L, const char *name, lua_CFunction func, int top)
 
static int l_deprecated_function (lua_State *L, const char *good, const char *bad, lua_CFunction func)
 A wrapper for deprecated functions. More...
 

Static Private Member Functions

static int gc_object (lua_State *L)
 
static int l_get (lua_State *L)
 
static int l_get_bool (lua_State *L)
 
static int l_get_np_group (lua_State *L)
 
static int l_get_flags (lua_State *L)
 
static int l_set (lua_State *L)
 
static int l_set_bool (lua_State *L)
 
static int l_set_np_group (lua_State *L)
 
static int l_remove (lua_State *L)
 
static int l_get_names (lua_State *L)
 
static int l_write (lua_State *L)
 
static int l_to_table (lua_State *L)
 

Private Attributes

Settingsm_settings = nullptr
 
std::string m_filename
 
bool m_is_own_settings = false
 
bool m_write_allowed = true
 

Static Private Attributes

static const char className [] = "Settings"
 
static const luaL_Reg methods []
 

Additional Inherited Members

- Protected Member Functions inherited from LuaHelper
template<>
bool readParam (lua_State *L, int index)
 
- Static Protected Member Functions inherited from LuaHelper
static bool isNaN (lua_State *L, int idx)
 
template<typename T >
static T readParam (lua_State *L, int index)
 Read a value using a template type T from Lua State L and index. More...
 
template<typename T >
static T readParam (lua_State *L, int index, const T &default_value)
 Read a value using a template type T from Lua State L and index. More...
 

Constructor & Destructor Documentation

◆ LuaSettings() [1/2]

LuaSettings::LuaSettings ( Settings settings,
const std::string &  filename 
)

Referenced by create(), and create_object().

+ Here is the caller graph for this function:

◆ LuaSettings() [2/2]

LuaSettings::LuaSettings ( const std::string &  filename,
bool  write_allowed 
)

References m_settings, and Settings::readConfigFile().

+ Here is the call graph for this function:

◆ ~LuaSettings()

LuaSettings::~LuaSettings ( )

References m_is_own_settings, and m_settings.

Member Function Documentation

◆ checkobject()

LuaSettings * LuaSettings::checkobject ( lua_State *  L,
int  narg 
)
static

References className, and NO_MAP_LOCK_REQUIRED.

Referenced by l_get(), l_get_bool(), l_get_flags(), l_get_names(), l_get_np_group(), l_remove(), l_set(), l_set_bool(), l_set_np_group(), l_to_table(), and l_write().

+ Here is the caller graph for this function:

◆ create()

void LuaSettings::create ( lua_State *  L,
Settings settings,
const std::string &  filename 
)
static

References LuaSettings(), and className.

Referenced by ModApiUtil::Initialize(), and ModApiUtil::InitializeAsync().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_object()

int LuaSettings::create_object ( lua_State *  L)
static

References LuaSettings(), CHECK_SECURE_PATH_POSSIBLE_WRITE, className, and NO_MAP_LOCK_REQUIRED.

Referenced by Register().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gc_object()

int LuaSettings::gc_object ( lua_State *  L)
staticprivate

Referenced by Register().

+ Here is the caller graph for this function:

◆ l_get()

int LuaSettings::l_get ( lua_State *  L)
staticprivate

References checkobject(), Settings::exists(), Settings::get(), m_settings, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_get_bool()

int LuaSettings::l_get_bool ( lua_State *  L)
staticprivate

References checkobject(), Settings::exists(), Settings::getBool(), m_settings, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_get_flags()

int LuaSettings::l_get_flags ( lua_State *  L)
staticprivate

References checkobject(), Settings::getFlagDescFallback(), Settings::getFlagStrNoEx(), m_settings, NO_MAP_LOCK_REQUIRED, and table.

+ Here is the call graph for this function:

◆ l_get_names()

int LuaSettings::l_get_names ( lua_State *  L)
staticprivate

References checkobject(), Settings::getNames(), m_settings, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_get_np_group()

int LuaSettings::l_get_np_group ( lua_State *  L)
staticprivate

References checkobject(), Settings::exists(), Settings::getNoiseParams(), m_settings, NO_MAP_LOCK_REQUIRED, and push_noiseparams().

+ Here is the call graph for this function:

◆ l_remove()

int LuaSettings::l_remove ( lua_State *  L)
staticprivate

References checkobject(), m_settings, NO_MAP_LOCK_REQUIRED, Settings::remove(), and SET_SECURITY_CHECK.

+ Here is the call graph for this function:

◆ l_set()

int LuaSettings::l_set ( lua_State *  L)
staticprivate

References checkobject(), m_settings, NO_MAP_LOCK_REQUIRED, Settings::set(), and SET_SECURITY_CHECK.

+ Here is the call graph for this function:

◆ l_set_bool()

int LuaSettings::l_set_bool ( lua_State *  L)
staticprivate

References checkobject(), m_settings, NO_MAP_LOCK_REQUIRED, SET_SECURITY_CHECK, and Settings::setBool().

+ Here is the call graph for this function:

◆ l_set_np_group()

int LuaSettings::l_set_np_group ( lua_State *  L)
staticprivate

References checkobject(), m_settings, NO_MAP_LOCK_REQUIRED, read_noiseparams(), SET_SECURITY_CHECK, and Settings::setNoiseParams().

+ Here is the call graph for this function:

◆ l_to_table()

int LuaSettings::l_to_table ( lua_State *  L)
staticprivate

References checkobject(), Settings::get(), Settings::getNames(), m_settings, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_write()

int LuaSettings::l_write ( lua_State *  L)
staticprivate

References checkobject(), m_filename, m_settings, m_write_allowed, NO_MAP_LOCK_REQUIRED, and Settings::updateConfigFile().

+ Here is the call graph for this function:

◆ Register()

void LuaSettings::Register ( lua_State *  L)
static

References className, create_object(), gc_object(), and methods.

Referenced by ServerScripting::InitializeModApi(), and MainMenuScripting::registerLuaClasses().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ className

const char LuaSettings::className = "Settings"
staticprivate

◆ m_filename

std::string LuaSettings::m_filename
private

Referenced by l_write().

◆ m_is_own_settings

bool LuaSettings::m_is_own_settings = false
private

Referenced by ~LuaSettings().

◆ m_settings

◆ m_write_allowed

bool LuaSettings::m_write_allowed = true
private

Referenced by l_write().

◆ methods

const luaL_Reg LuaSettings::methods
staticprivate
Initial value:
= {
luamethod(LuaSettings, get_bool),
luamethod(LuaSettings, get_np_group),
luamethod(LuaSettings, get_flags),
luamethod(LuaSettings, set_bool),
luamethod(LuaSettings, set_np_group),
luamethod(LuaSettings, get_names),
luamethod(LuaSettings, to_table),
{0,0}
}
Definition: l_settings.h:28
#define luamethod(class, name)
Definition: l_internal.h:31

Referenced by Register().


The documentation for this class was generated from the following files: