Posted 19 June 2014 - 08:49 AM
Please help me, in this code:
full code is here
and i getting error with the 44. line.
full code is here
and i getting error with the 44. line.
function scanJars()
local myEmptyJars = 0
local myTotalJars = 0
local jars = {}
local jarID = 1
local aspect
local aspectCount
local i, j
for i,j in ipairs(peripheral.getNames()) do
if peripheral.getType(j) == "tilejar" then
base = peripheral.call(j, "getAspects")[1.0]
aspect = base["name"]
aspectCount = base["quantity"]
if (aspectCount > 0) then
jars[jarID] = {}
jars[jarID]["aspect"] = aspect
jars[jarID]["count"] = aspectCount
jarID = jarID + 1
myTotalJars = myTotalJars + 1
elseif (aspectCount == 0) then
myEmptyJars = myEmptyJars + 1
myTotalJars = myTotalJars + 1
end
end
end
emptyJars = myEmptyJars
totalJars = myTotalJars
return jars
end
function updateEssentia()
local myJars
local myEssentia
local i, j
myJars = scanJars()
myEssentia = essentiaList()
for i in pairs(myJars) do
myEssentia[myJars[i]["aspect"]] = myEssentia[myJars[i]["aspect"]] + myJars[i]["count"]
end
for i,j in sortEss(myEssentia) do
if (essentia[i] ~= j) then
essentia[i] = j
end
end
end
Edited by