Lucemodok Posted March 31, 2021 Share Posted March 31, 2021 (edited) So I've been trying to get some custom server creation tabs to work in my mod, but I can't seem to make it work. The code: Spoiler local CurrentScreen = GLOBAL.TheFrontEnd:GetActiveScreen() if CurrentScreen and CurrentScreen.server_settings_tab and CurrentScreen.server_settings_tab.game_mode.spinner.enabled then local self = CurrentScreen self.server_settings_tab.game_mode.spinner:SetOptions(GLOBAL.GetGameModesSpinnerData(GLOBAL.ModManager:GetEnabledServerModNames())) self.server_settings_tab.game_mode.spinner:SetSelected("bigfreeze") self.server_settings_tab.game_mode.spinner:Changed() self.server_settings_tab.game_mode.spinner:Disable() local bigfreeze_locations = { "bigfreeze", "lonely_mine", } self.tabscreener.menu:Kill() self.tabscreener.menu = nil self.world_tabs = {} for index, location in ipairs(bigfreeze_locations) do self.tabscreener.sub_screens[location] = self:MakeWorldTab(index) end self:SetLevelLocations(bigfreeze_locations) self.tabscreener.menu = self:_BuildTabMenu(self.tabscreener) self:SetTab("mods") end Any help is much appreciated. For clarity, this is in the modworldgenmain and the crash (which only happens when I click on a tab) is as follows: Spoiler [00:00:55]: [string "scripts/util.lua"]:940: attempt to perform arithmetic on local 'index' (a nil value) LUA ERROR stack traceback: scripts/util.lua:940 in (global) circular_index_number (Lua) <939-944> count = 5 index = nil scripts/widgets/redux/headertabs.lua:45 in (method) SelectButton (Lua) <43-47> self = enabled = true focus_target = false selected_index = 4 shown = true parent = NineSlice focus_forward = MENU can_fade_alpha = true menu = MENU focus_flow_args = table: 2EF0B270 inst = 104221 - (valid:true) focus = true focus_flow = table: 2EF0B388 name = HeaderTabs children = table: 2EF0ABB8 callbacks = table: 2EF0B220 index = nil Edited March 31, 2021 by Lucemodok Link to comment https://forums.kleientertainment.com/forums/topic/128471-help-with-adding-a-tab-to-the-server-creation-screen/ Share on other sites More sharing options...
Bigfootmech Posted April 1, 2021 Share Posted April 1, 2021 [00:00:55]: [string "scripts/util.lua"]:940: attempt to perform arithmetic on local 'index' (a nil value) In file: scripts/util.lua line: 940 tried to do something like: a = index + b but: index is nil (hasn't been set yet) If this isn't super clear, I also found a similar article on stackoverflow after a quick DuckDuckGO search https://stackoverflow.com/questions/32001268/lua-attempt-to-perform-arithmetic-on-global-mapfinishes-a-nil-value Link to comment https://forums.kleientertainment.com/forums/topic/128471-help-with-adding-a-tab-to-the-server-creation-screen/#findComment-1443485 Share on other sites More sharing options...
Lucemodok Posted April 1, 2021 Author Share Posted April 1, 2021 I found a way for the index not to be nil, but I'm getting another error now. Link to comment https://forums.kleientertainment.com/forums/topic/128471-help-with-adding-a-tab-to-the-server-creation-screen/#findComment-1443820 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now