aboutsummaryrefslogtreecommitdiff
path: root/src/scriptapi.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-04-01 13:08:52 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-04-01 13:08:52 +0300
commit8ecfd88d92b0c8bf695f862b76077488127ab33f (patch)
tree13b1e4ebc8fd1f030f936a4cd8a023978e4b7e4e /src/scriptapi.cpp
parentb54178bbbdf7e66ef5107fe3d0fe434b60cd9a68 (diff)
downloadminetest-8ecfd88d92b0c8bf695f862b76077488127ab33f.tar.gz
minetest-8ecfd88d92b0c8bf695f862b76077488127ab33f.tar.bz2
minetest-8ecfd88d92b0c8bf695f862b76077488127ab33f.zip
Remplement and improve /setting in Lua, now called /set
Diffstat (limited to 'src/scriptapi.cpp')
-rw-r--r--src/scriptapi.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp
index ac5142209..f8fca00c7 100644
--- a/src/scriptapi.cpp
+++ b/src/scriptapi.cpp
@@ -3800,6 +3800,15 @@ static int l_register_craft(lua_State *L)
return 0; /* number of results */
}
+// setting_set(name, value)
+static int l_setting_set(lua_State *L)
+{
+ const char *name = luaL_checkstring(L, 1);
+ const char *value = luaL_checkstring(L, 2);
+ g_settings->set(name, value);
+ return 0;
+}
+
// setting_get(name)
static int l_setting_get(lua_State *L)
{
@@ -4006,6 +4015,7 @@ static const struct luaL_Reg minetest_f [] = {
{"register_item_raw", l_register_item_raw},
{"register_alias_raw", l_register_alias_raw},
{"register_craft", l_register_craft},
+ {"setting_set", l_setting_set},
{"setting_get", l_setting_get},
{"setting_getbool", l_setting_getbool},
{"chat_send_all", l_chat_send_all},