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

peripheral.find(self)

Started by EveryOS, 28 April 2016 - 10:55 AM
EveryOS #1
Posted 28 April 2016 - 12:55 PM
I really want to get a handle using peripheral.find
The problem is, self refers to a table,and I need a string.
Also, the computer finding the peripheral is not a peripheral.

Is there a way around this, without using term.native() or term
Bomb Bloke #2
Posted 28 April 2016 - 01:38 PM
wut

You may need to elaborate. Preferably by providing the code you're using to try… whatever it is you're attempting.

The problem is, self refers to a table,and I need a string.

Where's "self" coming from? Why are you making it a table in the first place, and what's in it? Why do you expect any sort of useful answer when you haven't provided this information?

Also, the computer finding the peripheral is not a peripheral.

Er, yes it is, even if you're not using it as one! Not that this appears relevant to the issue at hand?

Is there a way around this, without using term.native() or term

What on earth would terminal objects have to do with your ability to find peripherals?
EveryOS #3
Posted 28 April 2016 - 01:54 PM
The problem is, self refers to a table,and I need a string.

Where's "self" coming from? Why are you making it a table in the first place, and what's in it? Why do you expect any sort of useful answer when you haven't provided this information?
It's nil, but it's not if you are using a table.
Is there a way around this, without using term.native() or term
What on earth would terminal objects have to do with your ability to find peripherals?
peripheral.find returns a terminal object for a peripheral, doesn't it. And if you are trying to get a computer as a peripheral, it's going to return something that looks (almost) exactly like the default terminal.

The code:

handle = peripheral.find(self or 'computer')
Edited on 28 April 2016 - 11:53 AM
Bomb Bloke #4
Posted 28 April 2016 - 01:59 PM
It's nil, but it's not if you are using a table.

That doesn't address the question asked.

peripheral.find returns a terminal object for a peripheral, doesn't it.

Er, no. Terminal objects aren't for peripherals, and are only returned in the first place if you search for a suitable peripheral - such as a monitor. I'm not aware of any other peripheral types which can be used as terminal objects after wrapping.

And if you are trying to get a computer as a peripheral, it's going to return something that looks (almost) exactly like the default terminal.

No, you're going to get a table with with the functions outlined here.

The code:

That code in no way attempts to define "self".
EveryOS #5
Posted 28 April 2016 - 02:04 PM
OK, I do put more importance in my other topic, though.
Dragon53535 #6
Posted 29 April 2016 - 12:09 AM
You ask these arbitrary questions as if each is isolated. Could you give an example of what you want to receive, while also saying what you want to achieve and then I think we should all be on the same page.

When you wrap a computer you get back a table, peripheral.find automatically wraps, and the only things you can do with a wrapped computer is outlined here. Nothing more, nothing less.

You cannot view it's screen, any input it may have, it's current running program, nothing. You can only tell it to start up, turn off, reboot, and get it's ID and tell if it's on or not. That is it. If you want to be able to manipulate a computer using another computer you need to write your own program to be able to do so.