aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu/common.lua
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/mainmenu/common.lua')
-rw-r--r--builtin/mainmenu/common.lua28
1 files changed, 12 insertions, 16 deletions
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua
index 6db351048..8db8bb8d1 100644
--- a/builtin/mainmenu/common.lua
+++ b/builtin/mainmenu/common.lua
@@ -119,31 +119,27 @@ function render_serverlist_row(spec)
return table.concat(details, ",")
end
-
---------------------------------------------------------------------------------
-os.tempfolder = function()
- local temp = core.get_temp_path()
- return temp .. DIR_DELIM .. "MT_" .. math.random(0, 10000)
-end
-
+---------------------------------------------------------------------------------
os.tmpname = function()
- local path = os.tempfolder()
- io.open(path, "w"):close()
- return path
+ error('do not use') -- instead use core.get_temp_path()
end
--------------------------------------------------------------------------------
-function menu_render_worldlist()
- local retval = ""
+function menu_render_worldlist(show_gameid)
+ local retval = {}
local current_worldlist = menudata.worldlist:get_list()
+ local row
for i, v in ipairs(current_worldlist) do
- if retval ~= "" then retval = retval .. "," end
- retval = retval .. core.formspec_escape(v.name) ..
- " \\[" .. core.formspec_escape(v.gameid) .. "\\]"
+ row = v.name
+ if show_gameid == nil or show_gameid == true then
+ row = row .. " [" .. v.gameid .. "]"
+ end
+ retval[#retval+1] = core.formspec_escape(row)
+
end
- return retval
+ return table.concat(retval, ",")
end
function menu_handle_key_up_down(fields, textlist, settingname)