Jump to content




help modifying scanEssentia function


  • You cannot reply to this topic
2 replies to this topic

#1 meat113

  • Members
  • 4 posts

Posted 19 August 2014 - 04: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


#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 19 August 2014 - 04: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


#3 meat113

  • Members
  • 4 posts

Posted 19 August 2014 - 04:52 PM

Thanks, I figured it out now :)





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users