View Full Version : Post 2021-02 Modifier Stack Errors
Netzilla
March 8th, 2021, 17:09
I've been working on getting my ruleset to be fully compatible with the but 2021-02 changes. I've gotten most things worked out and have implemented all the required and recommended changes list here (https://www.fantasygrounds.com/forums/showthread.php?65561-Developer-Notes-2021-02-Ruleset-Updates&p=574220&viewfull=1#post574220), however one issue remains that I am stumped trying to resolve.
Whenever a number is entered into the Modifier Stack tool, all subsequent die rolls result in the following error, even after the Modifier Stack is cleared:
[3/8/2021 10:25:08 AM] [ERROR] Script execution error: [string "scripts/manager_modifierstack.lua"]:135: bad argument #3 to 'format' (number expected, got nil)
Any suggestions on what I'm need to look at to resolve this?
Trenloe
March 8th, 2021, 17:23
Looks like there's something in a modifier slot that has a description but not an associated number modifier.
The code that's raising the error is this:
table.insert(aMods, string.format("%s %+d", slots[i].description, slots[i].number));
With slots[i].number being the problem, slots[i].description appears to be OK.
Netzilla
March 8th, 2021, 18:26
That's part of what stumps me. I actually type the number in the modifier stack control and it display +2 (for example) but when the roll is made, I get the error. I don't know why it would have a description but not a number in that scenario.
Netzilla
March 8th, 2021, 18:53
So, as a bit of debugging, I added code to list out what's in the ActionsManager.slots array during my attack action, right before I get the error and it's empty:
s'manager_actions_champions6e.checkModStack' | s'aSlots: ' | { }
Code I'm using to print the modifier stack:
function checkModStack()
local sMethod = CLASS_NM .. ".checkModStack";
local aSlots = ModifierStack.slots;
Debug.chat(sMethod, "aSlots: ", aSlots);
for i = 1, #aSlots do
Debug.chat(sMethod, "Modifier Slot " .. i, aSlots[i]);
end
end
Trenloe
March 8th, 2021, 18:56
I'm not sure which way LUA checked the variables, so it could be that both description and number are blank, but it's just reporting number first. I thought it checked from the left of the function arguments, but maybe not.
Netzilla
March 8th, 2021, 21:37
Finally figured it out. There was a range modifier being passed into the stack with a non-numeric modifier number. Odd that the stack showed empty, and the error was complaining about a nil, however.
Thanks for the help.
Trenloe
March 8th, 2021, 22:25
Cool. Glad you got it sorted out.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.