PDA

View Full Version : Fudge die bug?



Bidmaron
January 14th, 2017, 15:55
As I'm working my extension, I ran across the following code in the manager_table.lua file in the function prepareTableDice:


local nRandom = math.random(3);
if nRandom == 1 then
nResult = -1;
elseif nRandom == 3 then
nResult = 1;
end

shouldn't that be:


local nRandom = math.random(3);
if nRandom == 1 then
nResult = -1;
elseif nRandom == 3 then
nResult = 1;
else
nResult=0;
end

Andraax
January 14th, 2017, 17:07
nResult is unassigned, so it's interpreted as 0. Assigning it makes it explicit, but it's not needed.

Bidmaron
January 14th, 2017, 17:11
You are absolutely correct. Right before the code I pasted is the line "local nResult;" which essentially sets it to zero.