add support for saving settings by lua command (server doesn't autosave on exit)
authorsapier <Sapier at GMX dot net>
Wed, 16 Jan 2013 20:23:56 +0000 (20:23 +0000)
committerPerttu Ahola <celeron55@gmail.com>
Mon, 21 Jan 2013 20:44:41 +0000 (22:44 +0200)
doc/lua_api.txt
src/scriptapi.cpp

index 94fc78b2e93777a901ac58dccbaab24069c72357..f935849caaad66368f7d91bcdcde61fa4b045e6d 100644 (file)
@@ -860,6 +860,7 @@ minetest.setting_set(name, value)
 minetest.setting_get(name) -> string or nil
 minetest.setting_getbool(name) -> boolean value or nil
 minetest.setting_get_pos(name) -> position or nil
+minetest.setting_save() -> nil, save all settings to config file
 minetest.add_to_creative_inventory(itemstring)
 
 Authentication:
index ec3d34676672decfdcca5db0d2a5f9b7665bd7f2..13ba72056a6a53ba25b9dcb94d465c3442ac5077 100644 (file)
@@ -4881,6 +4881,13 @@ static int l_setting_getbool(lua_State *L)
        return 1;
 }
 
+// setting_save()
+static int l_setting_save(lua_State *L)
+{
+       get_server(L)->saveConfig();
+       return 0;
+}
+
 // chat_send_all(text)
 static int l_chat_send_all(lua_State *L)
 {
@@ -5350,6 +5357,7 @@ static const struct luaL_Reg minetest_f [] = {
        {"setting_set", l_setting_set},
        {"setting_get", l_setting_get},
        {"setting_getbool", l_setting_getbool},
+       {"setting_save",l_setting_save},
        {"chat_send_all", l_chat_send_all},
        {"chat_send_player", l_chat_send_player},
        {"get_player_privs", l_get_player_privs},