31 std::string preference_name = luaL_checkstring(L, 2);
45 std::string preference_name = luaL_checkstring(L, 2);
54 std::vector<std::string> all_prefs;
56 for(
const std::string& attr :
prefs::get().all_attributes()) {
57 all_prefs.push_back(attr);
62 for(
const auto& pref :
prefs::get().get_advanced_preferences()) {
63 all_prefs.push_back(pref.field);
74 lua_getglobal(L,
"wesnoth");
79 lua_setfield(L, -2,
"__index");
81 lua_setfield(L, -2,
"__newindex");
83 lua_setfield(L, -2,
"__dir");
84 lua_pushstring(L,
"src/scripting/lua_preferences.cpp");
85 lua_setfield(L, -2,
"__metatable");
89 lua_setmetatable(L, -2);
92 lua_setfield(L, -2,
"preferences");
97 return "Adding preferences table...\n";
Variant for storing WML attributes.
Definitions for the interface to Wesnoth Markup Language (WML).
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.
int impl_preferences_set(lua_State *L)
The __newindex metamethod.
static int impl_preferences_dir(lua_State *L)
int impl_preferences_get(lua_State *L)
The __index metamethod.
std::string register_table(lua_State *L)
void lua_push(lua_State *L, const T &val)