Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
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 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 EmergeThreadgetEmergeThread (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 void registerClass (lua_State *L, const char *name, const luaL_Reg *methods, const luaL_Reg *metamethods)
 
template<typename T >
static T * checkObject (lua_State *L, int narg)
 
static int l_deprecated_function (lua_State *L, const char *good, const char *bad, lua_CFunction func)
 A wrapper for deprecated functions.
 

Static Public Attributes

static const char className [] = "Settings"
 

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_has (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 luaL_Reg methods []
 

Additional Inherited Members

- Protected Member Functions inherited from LuaHelper
template<>
bool readParam (lua_State *L, int index)
 
template<>
s16 readParam (lua_State *L, int index)
 
template<>
int readParam (lua_State *L, int index)
 
template<>
float readParam (lua_State *L, int index)
 
template<>
v2s16 readParam (lua_State *L, int index)
 
template<>
v2f readParam (lua_State *L, int index)
 
template<>
v3f readParam (lua_State *L, int index)
 
template<>
std::string_view readParam (lua_State *L, int index)
 
template<>
std::string readParam (lua_State *L, int index)
 
template<>
std::string_view readParam (lua_State *L, int index)
 Read a string from Lua state L at index without copying it.
 
- Static Protected Member Functions inherited from LuaHelper
template<typename T >
static T readParam (lua_State *L, int index)
 Read a value using a template type T from Lua state L at index.
 
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 at index.
 

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

◆ create()

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

References LuaSettings(), className, and settings.

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

+ 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 ModApiBase::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 ModApiBase::checkObject(), Settings::exists(), Settings::getBool(), m_settings, NO_MAP_LOCK_REQUIRED, and LuaHelper::readParam().

+ Here is the call graph for this function:

◆ l_get_flags()

int LuaSettings::l_get_flags ( lua_State * L)
staticprivate

References ModApiBase::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 ModApiBase::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 ModApiBase::checkObject(), Settings::exists(), Settings::getNoiseParams(), m_settings, NO_MAP_LOCK_REQUIRED, and push_noiseparams().

+ Here is the call graph for this function:

◆ l_has()

int LuaSettings::l_has ( lua_State * L)
staticprivate

References ModApiBase::checkObject(), Settings::existsLocal(), m_settings, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_remove()

int LuaSettings::l_remove ( lua_State * L)
staticprivate

References CHECK_SETTING_SECURITY, ModApiBase::checkObject(), m_settings, NO_MAP_LOCK_REQUIRED, and Settings::remove().

+ Here is the call graph for this function:

◆ l_set()

int LuaSettings::l_set ( lua_State * L)
staticprivate

References CHECK_SETTING_SECURITY, ModApiBase::checkObject(), m_settings, NO_MAP_LOCK_REQUIRED, and Settings::set().

+ Here is the call graph for this function:

◆ l_set_bool()

int LuaSettings::l_set_bool ( lua_State * L)
staticprivate

References CHECK_SETTING_SECURITY, ModApiBase::checkObject(), m_settings, NO_MAP_LOCK_REQUIRED, LuaHelper::readParam(), 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 CHECK_SETTING_SECURITY, ModApiBase::checkObject(), m_settings, NO_MAP_LOCK_REQUIRED, read_noiseparams(), and Settings::setNoiseParams().

+ Here is the call graph for this function:

◆ l_to_table()

int LuaSettings::l_to_table ( lua_State * L)
staticprivate

References ModApiBase::checkObject(), m_settings, NO_MAP_LOCK_REQUIRED, and push_settings_table().

+ Here is the call graph for this function:

◆ l_write()

int LuaSettings::l_write ( lua_State * L)
staticprivate

References ModApiBase::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(), methods, and ModApiBase::registerClass().

Referenced by ServerScripting::InitializeAsync(), ClientScripting::InitializeModApi(), EmergeScripting::InitializeModApi(), 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"
static

Referenced by create(), create_object(), and Register().

◆ 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}
}
static void remove(TestMap &map, size_t offset, size_t count)
Definition benchmark_mapmodify.cpp:32
Definition l_settings.h:13
#define luamethod(class, name)
Definition l_internal.h:16

Referenced by Register().


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