if fields["key_up"] then
local oldidx = engine.get_textlist_index(textlist)
- if oldidx > 1 then
+ if oldidx ~= nil and oldidx > 1 then
local newidx = oldidx -1
engine.setting_set(settingname,
filterlist.get_raw_index(worldlist,newidx))
if fields["key_down"] then
local oldidx = engine.get_textlist_index(textlist)
- if oldidx < filterlist.size(worldlist) then
+ if oldidx ~= nil and oldidx < filterlist.size(worldlist) then
local newidx = oldidx + 1
engine.setting_set(settingname,
filterlist.get_raw_index(worldlist,newidx))
local worldname = fields["te_world_name"]
local gameindex = engine.get_textlist_index("games")
- if gameindex > 0 and
+ if gameindex ~= nil and
worldname ~= "" then
local message = nil
local fav_idx = engine.get_textlist_index("favourites")
- if fields["key_up"] ~= nil and fav_idx > 1 then
- fav_idx = fav_idx -1
- else if fields["key_down"] and fav_idx < #menu.favorites then
- fav_idx = fav_idx +1
- end end
+ if fav_idx ~= nil then
+ if fields["key_up"] ~= nil and fav_idx > 1 then
+ fav_idx = fav_idx -1
+ else if fields["key_down"] and fav_idx < #menu.favorites then
+ fav_idx = fav_idx +1
+ end end
+ end
local address = menu.favorites[fav_idx].address
local port = menu.favorites[fav_idx].port
if fields["btn_delete_favorite"] ~= nil then
local current_favourite = engine.get_textlist_index("favourites")
+ if current_favourite == nil then return end
engine.delete_favorite(current_favourite)
menu.favorites = engine.get_favorites()
menu.fav_selected = nil
local fav_idx = engine.get_textlist_index("favourites")
- if fav_idx > 0 and fav_idx <= #menu.favorites and
+ if fav_idx ~= nil and fav_idx <= #menu.favorites and
menu.favorites[fav_idx].address == fields["te_address"] and
menu.favorites[fav_idx].port == fields["te_port"] then
world_doubleclick or
fields["key_enter"] then
local selected = engine.get_textlist_index("srv_worlds")
- if selected > 0 then
+ if selected ~= nil then
gamedata.playername = fields["te_playername"]
gamedata.password = fields["te_passwd"]
gamedata.port = fields["te_serverport"]
if fields["world_delete"] ~= nil then
local selected = engine.get_textlist_index("srv_worlds")
- if selected > 0 and
+ if selected ~= nil and
selected <= filterlist.size(worldlist) then
local world = filterlist.get_list(worldlist)[selected]
if world ~= nil and
if fields["world_configure"] ~= nil then
selected = engine.get_textlist_index("srv_worlds")
- if selected > 0 then
+ if selected ~= nil then
modmgr.world_config_selected_world = filterlist.get_raw_index(worldlist,selected)
if modmgr.init_worldconfig() then
tabbuilder.current_tab = "dialog_configure_world"
world_doubleclick or
fields["key_enter"] then
local selected = engine.get_textlist_index("sp_worlds")
- if selected > 0 then
+ if selected ~= nil then
gamedata.selected_world = filterlist.get_raw_index(worldlist,selected)
gamedata.singleplayer = true
if fields["world_delete"] ~= nil then
local selected = engine.get_textlist_index("sp_worlds")
- if selected > 0 and
+ if selected ~= nil and
selected <= filterlist.size(worldlist) then
local world = filterlist.get_list(worldlist)[selected]
if world ~= nil and
if fields["world_configure"] ~= nil then
selected = engine.get_textlist_index("sp_worlds")
- if selected > 0 then
+ if selected ~= nil then
modmgr.world_config_selected_world = filterlist.get_raw_index(worldlist,selected)
if modmgr.init_worldconfig() then
tabbuilder.current_tab = "dialog_configure_world"
index)
local list = filter_texture_pack_list(engine.get_dirlist(engine.get_texturepath(), true))
local current_index = engine.get_textlist_index("TPs")
- if #list >= current_index then
+ if current_index ~= nil and #list >= current_index then
local new_path = engine.get_texturepath()..DIR_DELIM..list[current_index]
if list[current_index] == "None" then new_path = "" end