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

What would you like added to APIs?

Started by Alice, 23 February 2014 - 02:27 PM
Alice #1
Posted 23 February 2014 - 03:27 PM
I'm editing a handful of the APIs to add some stuff that I think are helpful when programming my new OS, so I would like your opinion on anything I should add.

ADDED:
peripheral.all() returns a table containing all peripherals directly next to the computer.

PLANNED:
None currently.
TheOddByte #2
Posted 23 February 2014 - 06:00 PM
Doesn't peripheral.getNames() essentially do the same thing?
You could pretty much do this

peripheral.all = function()
    local t = peripheral.getNames()
    return peripheral.getNames()
end
And there's your function :P/>

Anyway.. Maybe a function in fs that lets you create/mount/unmount a virtual disk/folder/computer? :P/>
The only upside of this is that it wouldn't fill your HDD if you have limited size.
Symmetryc #3
Posted 23 February 2014 - 06:04 PM

peripheral.all = peripheral.getNames
^ Even better ^ :P/>
Alice #4
Posted 23 February 2014 - 06:13 PM
Didn't know they had that :P/>
Thanks for the feedback, now I can delete useless code.

Any other ideas?
awsmazinggenius #5
Posted 24 February 2014 - 12:15 AM
I'm not gonna even start listing the things that are currently implemented in my OS, but here are a few off the top of my never-ending to-do list:
  • Mounting the storage on CC virtual machines (yes, you can make a CC virtual machine, in CC, to do regular VM stuff like test OS's, limit storage, etc.) to your regular storage EDIT: Derp. It already is, quite obviously. Just in a hidden (dot-prefixed) folder. I got up early to watch the Olympic Hockey Final, and I went to bed later then normal that same night, so I didn't get much sleep.
  • A call to wrap peripherals on other servers (provided they are all in loaded chunks and such) through the HTTP API. (I've got a basic concept going, but I need to make it more noob-friendly. Also, it currently requires you to host your own PHP script (which will be provided, but you have to host it.).)
  • A call to mount the storage of other computers on other servers to your local storage. (Just like above, loaded chunks and hosting and blah blah blah…)
Edited on 23 February 2014 - 11:18 PM
Alice #6
Posted 24 February 2014 - 12:53 AM
1: What do you mean by mounting the storage?
2: I have no idea how I would possibly connect two computers - or peripheral to computer - through the HTTP API (sockets would be very helpful here).
3: Seriously, add sockets. It would be so much easier for a dev to just add sockets.
awsmazinggenius #7
Posted 25 February 2014 - 09:58 AM
1. The first point in my list is strikethrough'ed
2. Through the PHP scripts. CC computer http.post's to a page with instructions, and after x (adjustable to stop spam) time has passed, CC computer 2 goes to a different URL which contains a page with instructions. Works with the CC HTTP API, no peripherals needed.
Alice #8
Posted 25 February 2014 - 10:19 AM
I will never use PHP, if anything I'll design my own light server.
awsmazinggenius #9
Posted 26 February 2014 - 06:02 AM
Any reasons against PHP? I like listening to others' opinions on coding.
Alice #10
Posted 26 February 2014 - 07:41 AM
I just don't like the language. It would be easier for me to custom design a server for it than to use PHP for it.
Shazz #11
Posted 26 February 2014 - 09:20 PM
I don't have anything against PHP (but I do admit some parts of the language are badly designed), I even use it in my projects. However, I agree with you that for this type of project, it would probably be better to write a quick web server in node.js as opposed to using Apache/nginx.