This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
meat113's profile picture

help modifying scanEssentia function

Started by meat113, 19 August 2014 - 03:17 PM
meat113 #1
Posted 19 August 2014 - 05:17 PM
For some reason, the ethereal jars from Advanced thaumaturgy were recognized as tt_aspectContainer but after the restart they changed to tileetherealjar, I am trying to make this code account for two different types of jars. I tried doing
if peripheral.getType(j) == "tt_aspectContainer" or "tileetherealjar" then, but this does not work, would I need to create a second for loop with different variables than i and j to get the other jars?

Link to full code: http://pastebin.com/tvBYFsrH

Here is the function I am trying to edit

function scanEssentia()
  for i,j in ipairs(jars) do
	 if peripheral.getType(j) == "tt_aspectContainer" then
	   asp = peripheral.call(j, "getAspects")
	   countasp = peripheral.call(j, "getAspectCount", asp)
	   if countasp > 0 then
		  essentia[asp] = math.floor(countasp)
	   end
--	   print(countasp)
--	 print(asp..":"..countasp)
--	 print(peripheral.getType(j))
	 end
  end
end
Lyqyd #2
Posted 19 August 2014 - 05:38 PM
You need to explicitly compare against both options. The or operator doesn't extend one comparison, it acts like a boolean or with the results of two expressions.


if x == "thing" or x == "thing2" then
meat113 #3
Posted 19 August 2014 - 05:52 PM
Thanks, I figured it out now :)/>