diff --git a/builtin/mainmenu/dlg_settings_advanced.lua b/builtin/mainmenu/dlg_settings_advanced.lua
index f5e80c252403d945c40586beae464d25d5aafed1..68b5fd4efeb930b40470854277c4e1aeabec7fd0 100644
--- a/builtin/mainmenu/dlg_settings_advanced.lua
+++ b/builtin/mainmenu/dlg_settings_advanced.lua
@@ -659,102 +659,5 @@ function create_adv_settings_dlg()
 				return dlg
 end
 
-local function create_minetest_conf_example()
-	local result = "#    This file contains a list of all available settings and their default value for minetest.conf\n" ..
-			"\n" ..
-			"#    By default, all the settings are commented and not functional.\n" ..
-			"#    Uncomment settings by removing the preceding #.\n" ..
-			"\n" ..
-			"#    minetest.conf is read by default from:\n" ..
-			"#    ../minetest.conf\n" ..
-			"#    ../../minetest.conf\n" ..
-			"#    Any other path can be chosen by passing the path as a parameter\n" ..
-			"#    to the program, eg. \"minetest.exe --config ../minetest.conf.example\".\n" ..
-			"\n" ..
-			"#    Further documentation:\n" ..
-			"#    http://wiki.minetest.net/\n" ..
-			"\n"
-
-	local settings = parse_config_file(true, false)
-	for _, entry in ipairs(settings) do
-		if entry.type == "category" then
-			if entry.level == 0 then
-				result = result .. "#\n# " .. entry.name .. "\n#\n\n"
-			else
-				for i = 1, entry.level do
-					result = result .. "#"
-				end
-				result = result .. "# " .. entry.name .. "\n\n"
-			end
-		else
-			if entry.comment ~= "" then
-				for _, comment_line in ipairs(entry.comment:split("\n", true)) do
-					result = result .."#    " .. comment_line .. "\n"
-				end
-			end
-			result = result .. "#    type: " .. entry.type
-			if entry.min then
-				result = result .. " min: " .. entry.min
-			end
-			if entry.max then
-				result = result .. " max: " .. entry.max
-			end
-			if entry.values then
-				result = result .. " values: " .. table.concat(entry.values, ", ")
-			end
-			if entry.possible then
-				result = result .. " possible values: " .. entry.possible:gsub(",", ", ")
-			end
-			result = result .. "\n"
-			local append = ""
-			if entry.default ~= "" then
-				append = " " .. entry.default
-			end
-			result = result .. "# " .. entry.name .. " =" .. append .. "\n\n"
-		end
-	end
-	return result
-end
-
-local function create_translation_file()
-	local result = "// This file is automatically generated\n" ..
-			"// It conatins a bunch of fake gettext calls, to tell xgettext about the strings in config files\n" ..
-			"// To update it, refer to the bottom of builtin/mainmenu/tab_settings.lua\n\n" ..
-			"fake_function() {\n"
-
-	local settings = parse_config_file(true, false)
-	for _, entry in ipairs(settings) do
-		if entry.type == "category" then
-			local name_escaped = entry.name:gsub("\"", "\\\"")
-			result = result .. "\tgettext(\"" .. name_escaped .. "\");\n"
-		else
-			if entry.readable_name then
-				local readable_name_escaped = entry.readable_name:gsub("\"", "\\\"")
-				result = result .. "\tgettext(\"" .. readable_name_escaped .. "\");\n"
-			end
-			if entry.comment ~= "" then
-				local comment_escaped = entry.comment:gsub("\n", "\\n")
-				comment_escaped = comment_escaped:gsub("\"", "\\\"")
-				result = result .. "\tgettext(\"" .. comment_escaped .. "\");\n"
-			end
-		end
-	end
-	result = result .. "}\n"
-	return result
-end
-
-if false then
-	local file = io.open("minetest.conf.example", "w")
-	if file then
-		file:write(create_minetest_conf_example())
-		file:close()
-	end
-end
-
-if false then
-	local file = io.open("src/settings_translation_file.cpp", "w")
-	if file then
-		file:write(create_translation_file())
-		file:close()
-	end
-end
+-- generate minetest.conf.example and settings_translation_file.cpp:
+--assert(loadfile(core.get_mainmenu_path()..DIR_DELIM.."generate_from_settingtypes.lua"))(parse_config_file(true, false))
diff --git a/builtin/mainmenu/generate_from_settingtypes.lua b/builtin/mainmenu/generate_from_settingtypes.lua
new file mode 100644
index 0000000000000000000000000000000000000000..62d11b29b477a7b2cb81a95bed0a0129e090792e
--- /dev/null
+++ b/builtin/mainmenu/generate_from_settingtypes.lua
@@ -0,0 +1,99 @@
+local settings = ...
+
+local function create_minetest_conf_example()
+	local result = "#    This file contains a list of all available settings and their default value for minetest.conf\n" ..
+			"\n" ..
+			"#    By default, all the settings are commented and not functional.\n" ..
+			"#    Uncomment settings by removing the preceding #.\n" ..
+			"\n" ..
+			"#    minetest.conf is read by default from:\n" ..
+			"#    ../minetest.conf\n" ..
+			"#    ../../minetest.conf\n" ..
+			"#    Any other path can be chosen by passing the path as a parameter\n" ..
+			"#    to the program, eg. \"minetest.exe --config ../minetest.conf.example\".\n" ..
+			"\n" ..
+			"#    Further documentation:\n" ..
+			"#    http://wiki.minetest.net/\n" ..
+			"\n"
+
+	for _, entry in ipairs(settings) do
+		if entry.type == "category" then
+			if entry.level == 0 then
+				result = result .. "#\n# " .. entry.name .. "\n#\n\n"
+			else
+				for i = 1, entry.level do
+					result = result .. "#"
+				end
+				result = result .. "# " .. entry.name .. "\n\n"
+			end
+		else
+			if entry.comment ~= "" then
+				for _, comment_line in ipairs(entry.comment:split("\n", true)) do
+					result = result .."#    " .. comment_line .. "\n"
+				end
+			end
+			result = result .. "#    type: " .. entry.type
+			if entry.min then
+				result = result .. " min: " .. entry.min
+			end
+			if entry.max then
+				result = result .. " max: " .. entry.max
+			end
+			if entry.values then
+				result = result .. " values: " .. table.concat(entry.values, ", ")
+			end
+			if entry.possible then
+				result = result .. " possible values: " .. entry.possible:gsub(",", ", ")
+			end
+			result = result .. "\n"
+			local append = ""
+			if entry.default ~= "" then
+				append = " " .. entry.default
+			end
+			result = result .. "# " .. entry.name .. " =" .. append .. "\n\n"
+		end
+	end
+	return result
+end
+
+local function create_translation_file()
+	local result = "// This file is automatically generated\n" ..
+			"// It conatins a bunch of fake gettext calls, to tell xgettext about the strings in config files\n" ..
+			"// To update it, refer to the bottom of builtin/mainmenu/tab_settings.lua\n\n" ..
+			"fake_function() {\n"
+
+	for _, entry in ipairs(settings) do
+		if entry.type == "category" then
+			local name_escaped = entry.name:gsub("\"", "\\\"")
+			result = result .. "\tgettext(\"" .. name_escaped .. "\");\n"
+		else
+			if entry.readable_name then
+				local readable_name_escaped = entry.readable_name:gsub("\"", "\\\"")
+				result = result .. "\tgettext(\"" .. readable_name_escaped .. "\");\n"
+			end
+			if entry.comment ~= "" then
+				local comment_escaped = entry.comment:gsub("\n", "\\n")
+				comment_escaped = comment_escaped:gsub("\"", "\\\"")
+				result = result .. "\tgettext(\"" .. comment_escaped .. "\");\n"
+			end
+		end
+	end
+	result = result .. "}\n"
+	return result
+end
+
+if false then
+	local file = io.open("minetest.conf.example", "w")
+	if file then
+		file:write(create_minetest_conf_example())
+		file:close()
+	end
+end
+
+if false then
+	local file = io.open("src/settings_translation_file.cpp", "w")
+	if file then
+		file:write(create_translation_file())
+		file:close()
+	end
+end
\ No newline at end of file