
What happens
On the v20 public beta, removeButton() takes effect immediately. As soon as an object’s last button is removed, getButtons() returns nil, even in the same call.
On 14.x this does not break: our code removes a card’s buttons and then reads #getButtons() in the same call, and it has worked that way for years. The count it checks for only adds up if the removed buttons are still listed until the end of the frame, so 14.x appears to apply removals later.
Repro (run from Global, or paste into the Lua console)
local o = spawnObject({type = "BlockSquare", position = {0, 3, 0}})
o.createButton({click_function = "none", function_owner = Global, label = "A", width = 100, height = 100})
o.createButton({click_function = "none", function_owner = Global, label = "B", width = 100, height = 100})
o.removeButton(1)
o.removeButton(0)
print(#o.getButtons())Beta: error “attempt to get length of a nil value” (getButtons() returned nil).
Expected: no error, as with the same pattern in our mod on 14.x.
Impact
Our mod’s Auto Activate (it spawns a player’s whole squad: trays, cards, models, tokens) removes each character card’s buttons and then reads #getButtons() to check whether an Alt Art button is left to remove. On the beta that read errors, the script stops part way, and the player is left with empty trays: no character cards placed, no models, no tokens. On 14.x the same code works. Any legacy mod that reads getButtons() after removeButton() in the same call can break the same way.
Request
For legacy Workshop content, keep the 14.x behaviour, or at least have getButtons() return an empty table instead of nil. If the change is intended, please list it in the 2.0 scripting changes so mod authors can find it.
Mod: https://steamcommunity.com/sharedfiles/filedetails/?id=3036795456 (MCP TTS, Marvel Crisis Protocol, around 1k active players). Steps in the mod: Roster Maker > paste an MCT code > Create Roster > Open Roster > USE a few characters > Auto Activate.
Version: v20.0 public_beta (build 27134291), Windows 11.What happens
On the v20 public beta, removeButton() takes effect immediately. As soon as an object’s last button is removed, getButtons() returns nil, even in the same frame.
On 14.x, buttons removed with removeButton() were still listed by getButtons() until the end of the frame. Legacy scripts rely on that. Ours has removed a card’s buttons and then read the count in the same call for years, and it works on 14.x every time.
Repro (run from Global, or paste into the Lua console)
local o = spawnObject({type = "BlockSquare", position = {0, 3, 0}})
o.createButton({click_function = "none", function_owner = Global, label = "A", width = 100, height = 100})
o.createButton({click_function = "none", function_owner = Global, label = "B", width = 100, height = 100})
o.removeButton(1)
o.removeButton(0)
print(#o.getButtons())Beta: error “attempt to get length of a nil value” (getButtons() returned nil).
Expected (14.x behaviour): no error; the removed buttons are still listed until the frame ends.
Impact
Our mod’s Auto Activate (it spawns a player’s whole squad: trays, cards, models, tokens) removes each character card’s buttons and then reads #getButtons() to check whether there is an Alt Art button left to remove. On the beta that read errors, the script stops part way, and the player is left with empty trays: no character cards placed, no models, no tokens. On 14.x the same code works. Any legacy mod that reads getButtons() after removeButton() in the same call will break the same way.
Request
For legacy Workshop content, keep the 14.x behaviour (removals applied at the end of the frame), or at least have getButtons() return an empty table instead of nil. If the change is intended, please list it in the 2.0 scripting changes so mod authors can find it.
Mod: https://steamcommunity.com/sharedfiles/filedetails/?id=3036795456 (MCP TTS, Marvel Crisis Protocol, around 1k active players). Steps in the mod: Roster Maker > paste an MCT code > Create Roster > Open Roster > USE a few characters > Auto Activate.
Version: v20.0 public_beta (build 27134291), Windows 11.