The Battle for Wesnoth  1.15.1+dev
Namespaces | Functions
lua_preferences.cpp File Reference
#include "scripting/lua_preferences.hpp"
#include "config.hpp"
#include "lua/lua.h"
#include "lua/lauxlib.h"
#include "preferences/general.hpp"
#include "scripting/lua_common.hpp"
Include dependency graph for lua_preferences.cpp:

Go to the source code of this file.

Namespaces

 lua_preferences
 

Functions

static int impl_preferences_get (lua_State *L)
 The __index metamethod. More...
 
static int impl_preferences_set (lua_State *L)
 The __newindex metamethod. More...
 
std::string lua_preferences::register_table (lua_State *L)
 

Function Documentation

◆ impl_preferences_get()

static int impl_preferences_get ( lua_State L)
static

The __index metamethod.

Parameter 1: the preference table. Parameter 2: preference name, must be a string. Returns: preference value. If there isn't such a preference, returns nil.

Definition at line 29 of file lua_preferences.cpp.

References preferences::get_as_attribute(), luaL_checkstring, and luaW_pushscalar().

Referenced by lua_preferences::register_table().

◆ impl_preferences_set()

static int impl_preferences_set ( lua_State L)
static

The __newindex metamethod.

Parameter 1: the preference table. Parameter 2: preference name, must be a string. Parameter 3: preference value. Returns nothing.

Definition at line 43 of file lua_preferences.cpp.

References luaL_checkstring, luaW_toscalar(), and preferences::set().

Referenced by lua_preferences::register_table().