Posted 12 April 2014 - 07:13 AM
Hey guys, I'm looking to use 3 sets of tables, fill them with data, and then pull from these tables and so some calculations. However, I've read everything I can seem to muster up, and for some reason I'm getting a "attempted to add null and digit" error with the following code…
Any insight would be greatly appreciated. I'm hitting a wall here as far as other options to look into!
local function energyChangeRate()
count = count + 1
if count > 5 then count = 1 end
local chgValue = {ch1, ch2, chg3, chg4, chg5}
local chgValue2 = {total1, total2, total3, total4, total5}
local chgAvgTotal = {avg1, avg2, avg3, avg4, avg5}
chgValue[count] = energyLastScan
chgValue2[count] = levelTotal
print("count: "..count)
print("chgValue:"..chgValue[count])
print("chgValue2:"..chgValue2[count])
chgAvgTotal[count] = (chgValue2[count]) - (chgValue[count])
print("chgAvgTotal:"..chgAvgTotal[count])
if (chgAvgTotal[1]) and (chgAvgTotal[2]) and (chgAvgTotal[3]) and (chgAvgTotal[4]) and (chgAvgTotal[5]) ~= null then
totalEnergyChangeAverage = (chgAvgTotal[1] + chgAvgTotal[2] + chgAvgTotal[3] + chgAvgTotal[4] + chgAvgTotal[5]) / 5
else
totalEnergyChangeAverage = 0
clearLine(1,15)
printMon(totalEnergyChangeAverage.." RF/s", 1,15,colors.white,colors.black)
end
end
Any insight would be greatly appreciated. I'm hitting a wall here as far as other options to look into!