Posted 26 February 2012 - 09:16 AM
Is there any way to send arguments from one file to another?
For example, lets say you have a turtle, and on this turtle you've created 2 files: actionA.cmd and actionB.cmd
actionA.cmd looks something like this:
and actionB.cmd is something like this:
In this example, shell.run simply returns true as long as it's able to find the file. (At least, that's what I've come to understand through experimentation.)
But if you wanted actionB.cmd to return a value, much like you might a function, how would you go about doing that?
For example, lets say you have a turtle, and on this turtle you've created 2 files: actionA.cmd and actionB.cmd
actionA.cmd looks something like this:
...
arg = 0
ID, msg = rednet.receive()
if ID == 3 and msg == "password" then
arg = shell.run("actionB.cmd")
end
if arg then
-- Do stuff
end
and actionB.cmd is something like this:
if not turtle.detect() then
return true
else
return false
end
In this example, shell.run simply returns true as long as it's able to find the file. (At least, that's what I've come to understand through experimentation.)
But if you wanted actionB.cmd to return a value, much like you might a function, how would you go about doing that?