Cloudy, on 29 May 2012 - 06:51 PM, said:
Your problem is you're assigning the value of Sides[i] to dside and trying to return side. This code will be better though:
function getPeripheral(perType)
for k,v in pairs(rs.getSides()) do
if peripheral.getType(v) == perType then
return v
end
end
return nil
end
It will return the side that the peripheral is on.
What do i do with a "returned side", is it a variable, how do i call it? The limit of my experience is pretty much:
sSide = "however you got a string input"
rednet.open(sSide)
Plus, albeit unrelated to the thread, what's all that fancy stuff with the k,v in pairs and return nil?
MysticT, on 29 May 2012 - 06:54 PM, said:
You have to store it in a variable like this:
local side = hasPeripheral("name of the peripheral")
And then use it like:
peripheral.call(side, "Method", ...)
-- or
local p = peripheral.wrap(side)
p.<Method>(...)
peripheral.call(side, "Method", ...)
Is that phrase necessary for me to make use of the variable side, because i'm not sure how to use that phrase, let alone what "Method" means.
Would, for example, this work?
redstone.setBundledOutput(side, color)
Furthermore, you make it seem simple to store the side variable but I don't see where in the function the Sides[i] goes from a table to a string for me to store.
Thanks for the assist so far guys!