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

rs.testBundledInput Code

Started by IHHI, 21 August 2013 - 08:58 PM
IHHI #1
Posted 21 August 2013 - 10:58 PM
I want to know if someone can give me the code of the rs.testBundledInput. I'm not to sure where I can find it and by the way, if someone can refer me to something else that show the algorithm I would appreciate. I don't know what is the name of this kind of bit manipulation so I would love to know.
Lyqyd #2
Posted 22 August 2013 - 12:49 AM
Split into new topic.

It's going to essentially just be a bitwise AND operation. I don't know offhand whether they limit it to a single bit, or just return true if any bits of the result are true.
immibis #3
Posted 22 August 2013 - 01:40 AM
Something like this:

function rs.testBundledInput(side, colour)
  return colours.test(rs.getBundledInput(side), colour)
end
IHHI #4
Posted 22 August 2013 - 07:57 AM
At first, I though there was a decimal algorithm behind the rs.testBundledInput because we got the bitwise in an other API.

The function return true if the bits you test are present in the Bundled but why there is only rs.testBundledInput and no redstone.testBundledOutput, I am able to create this function with the bitwise but that could be a simple thing to add if someone got time.

My goal is to create a small function that will let's a user turn the bit true or false in the bundled. For the moment, the user can turn 1 bit a the time true or false by selecting the color and give the boolean or say all and true or false and it will turn all the bit to the correct state. What I want to create, it's a function that let's me add the color like colors.white + colors.orange + colors.blue and after that the user say true or false again. For the moment I got something similar to my video above but it's not exactly the same thing I am searching for. [media]http://www.youtube.com/watch?v=GkI-Z28SKCA[/media]