From 160046458ca014f9fb8c528e7b012f8f3e24e21e Mon Sep 17 00:00:00 2001 From: scarcer-1 Date: Fri, 13 Nov 2026 18:17:50 +0000 Subject: [PATCH] fix(start): recreate G.GAME.viewed_back when Steamodded's run select omits it On current Steamodded (main, 26.1026.0~dev-b), start fails on every run, including the first after a cold launch: INTERNAL_ERROR - src/lua/endpoints/start.lua:116: attempt to index field 'viewed_back' (a nil value) Steamodded's reworked run select (smods#1560/#1571, September 2026) no longer creates G.GAME.viewed_back on the setup_run() path, and the endpoint dereferences it unconditionally while applying the requested deck. It is not a "second run in the session" condition; restarting the game does not help. Recreate the object when it is missing (Back(deck_data)) and keep change_to behind a nil check, so start() works on both vanilla and current Steamodded. viewed_back only backs the deck-preview graphic, so recreating it is closer to vanilla behaviour than skipping the update. Upstream report: https://github.com/coder/balatrobot/issues/244 --- src/lua/endpoints/start.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lua/endpoints/start.lua b/src/lua/endpoints/start.lua index 5bcefa62..e778858b 100644 --- a/src/lua/endpoints/start.lua +++ b/src/lua/endpoints/start.lua @@ -113,7 +113,18 @@ return { if deck_data.name == deck_name then sendDebugMessage("Setting deck to: " .. deck_data.name .. " (from enum: " .. args.deck .. ")", "BB.ENDPOINTS") G.GAME.selected_back:change_to(deck_data) - G.GAME.viewed_back:change_to(deck_data) + -- Steamodded's reworked run select (smods#1560/#1571, Sept 2026) no + -- longer creates G.GAME.viewed_back on the setup_run path, so it is + -- nil here and indexing it aborts start() with: + -- attempt to index field 'viewed_back' (a nil value) + -- Recreate it when missing; it only backs the deck-preview graphic. + -- Upstream report: https://github.com/coder/balatrobot/issues/244 + if not G.GAME.viewed_back and Back then + G.GAME.viewed_back = Back(deck_data) + end + if G.GAME.viewed_back then + G.GAME.viewed_back:change_to(deck_data) + end deck_found = true break end