Posted 29 August 2015 - 02:02 AM
I have been working on a program that keeps a big reactor multiblock in equilibrium by managing the levels of input and output fluid and trying to optimize based on temperature. For this, I am using a few arrays that let me better keep track of average values that I get from some of the sensors. I have written this snippet of my code to initialize the 10 elements of 2 arrays to all 0 so that it doesnt return nil whenever I average it for the first few ticks. I attempted to initialize the values below as described below but I get an error on line '2' ( as relative to how it is pasted) that says "<programname>:<2>: index expected, got nil. I assumed that putting index = 1 would initialize the variable 'index' to 1 and so it should not be nil. But the interpreter says that it is. What am I doing wrong and how can I fix it?
- for index=1,10,1 do
- tempArray[index] = 0
- fluidArray[index] = 0
- end