1 posts
Posted 05 November 2012 - 12:48 PM
Okay, so lets say I have a computer that has a while loop that asks for a password. So I don't want to destroy that computer, but I want to run code from a disk while the other program is up, without having to reboot the computer. Is this possible? Some kind of virus?
119 posts
Location
Adelaide, Australia
Posted 25 November 2012 - 09:23 PM
I think you would need to look into the parallel API; I don't know much about the parallel API though.
62 posts
Location
Australia
Posted 25 November 2012 - 09:33 PM
You might want to look into the disk API.
Something like this.
driveSide = "left"
while true do
if disk.isPresent(driveSide) and disk.hasData(driveSide) then
os.run({}, "program on disk")
sleep(1)
disk.eject(driveSide)
end
sleep(2)
end
34 posts
Location
Programming Land
Posted 26 November 2012 - 05:31 AM
Use the parallel API.
http://computercraft.info/wiki/index.php?title=Parallel
function disk()
-- do the disk running stuff here
end
function pass()
-- do the pass stuff here
end
while true do
parallel.waitForAny(disk, pass)
end
2005 posts
Posted 26 November 2012 - 07:05 AM
Isn't the whole point of having a password loop to prevent the computer from doing anything until the password is entered?