33 std::string preference_name = luaL_checkstring(L, 2);
47 std::string preference_name = luaL_checkstring(L, 2);
56 std::vector<std::string> all_prefs;
58 all_prefs.push_back(key);
62 all_prefs.push_back(pref.field);
73 lua_getglobal(L,
"wesnoth");
78 lua_setfield(L, -2,
"__index");
80 lua_setfield(L, -2,
"__newindex");
82 lua_setfield(L, -2,
"__dir");
83 lua_pushstring(L,
"src/scripting/lua_preferences.cpp");
84 lua_setfield(L, -2,
"__metatable");
88 lua_setmetatable(L, -2);
91 lua_setfield(L, -2,
"preferences");
96 return "Adding preferences table...\n";
Variant for storing WML attributes.
bool luaW_toscalar(lua_State *L, int index, config::attribute_value &v)
Converts the value at the top of the stack to an attribute value.
void luaW_pushscalar(lua_State *L, const config::attribute_value &v)
Converts an attribute value into a Lua object pushed at the top of the stack.
static int impl_preferences_set(lua_State *L)
The __newindex metamethod.
static int impl_preferences_get(lua_State *L)
The __index metamethod.
static int impl_preferences_dir(lua_State *L)
std::string register_table(lua_State *L)
void set(const std::string &key, bool value)
config::attribute_value get_as_attribute(const std::string &key)
const advanced_pref_list & get_advanced_preferences()
Gets a list of the available advanced preferences.
void lua_push(lua_State *L, const T &val)