summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_settings.h
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-12-12 14:49:19 -0500
committerShadowNinja <shadowninja@minetest.net>2017-05-06 15:33:19 -0400
commit43d1f375d18a2fbc547a9b4f23d1354d645856ca (patch)
tree15de6977737b440b9d265f85dc1fe3c71e996a45 /src/script/lua_api/l_settings.h
parenta024042bf5ad487685e952da7b96ffa845cd7731 (diff)
downloadminetest-43d1f375d18a2fbc547a9b4f23d1354d645856ca.tar.gz
minetest-43d1f375d18a2fbc547a9b4f23d1354d645856ca.tar.bz2
minetest-43d1f375d18a2fbc547a9b4f23d1354d645856ca.zip
Use a settings object for the main settings
This unifies the settings APIs. This also unifies the sync and async registration APIs, since the async registration API did not support adding non-functions to the API table.
Diffstat (limited to 'src/script/lua_api/l_settings.h')
-rw-r--r--src/script/lua_api/l_settings.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/script/lua_api/l_settings.h b/src/script/lua_api/l_settings.h
index b90f0a8f2..f3bc7410b 100644
--- a/src/script/lua_api/l_settings.h
+++ b/src/script/lua_api/l_settings.h
@@ -42,6 +42,9 @@ private:
// set(self, key, value)
static int l_set(lua_State *L);
+ // set_bool(self, key, value)
+ static int l_set_bool(lua_State* L);
+
// remove(self, key) -> success
static int l_remove(lua_State *L);
@@ -54,16 +57,20 @@ private:
// to_table(self) -> {[key1]=value1,...}
static int l_to_table(lua_State *L);
- bool m_write_allowed;
Settings *m_settings;
std::string m_filename;
+ bool m_is_own_settings;
+ bool m_write_allowed;
public:
- LuaSettings(const char *filename, bool write_allowed);
+ LuaSettings(Settings *settings, const std::string &filename);
+ LuaSettings(const std::string &filename, bool write_allowed);
~LuaSettings();
+ static void create(lua_State *L, Settings *settings, const std::string &filename);
+
// LuaSettings(filename)
- // Creates an LuaSettings and leaves it on top of stack
+ // Creates a LuaSettings and leaves it on top of the stack
static int create_object(lua_State *L);
static LuaSettings *checkobject(lua_State *L, int narg);