Posted 06 November 2013 - 03:46 PM
I am reletivaly new to ComputerCraft and everything about programming and have been looking for how this works for about 2 hours now, but could find nothing.
Oke here is what I want to do.
I want to run a program in a program. So in the main program I clarify some variables and I want to use them in the other program, but I can't seem to make that work.
Here is my code for testing how to cary over variables:
y=1
os.run({},"test")
with test being
if y==1 then
print("yeah it works")
else
print("too bad :(/>")
So in the command os.run(…..) I must put stuff so it uses y, but how and what?
Thanks in advance!
p.s. does the variable also get carried over to the main program? Say I state y in mainprogram, stuff hapens to it in the subprogram and then stuff needs to happen to it in the main program. Is that possible or do I again have to do some fancy stuff I do not know about?
Oke here is what I want to do.
I want to run a program in a program. So in the main program I clarify some variables and I want to use them in the other program, but I can't seem to make that work.
Here is my code for testing how to cary over variables:
y=1
os.run({},"test")
with test being
if y==1 then
print("yeah it works")
else
print("too bad :(/>")
So in the command os.run(…..) I must put stuff so it uses y, but how and what?
Thanks in advance!
p.s. does the variable also get carried over to the main program? Say I state y in mainprogram, stuff hapens to it in the subprogram and then stuff needs to happen to it in the main program. Is that possible or do I again have to do some fancy stuff I do not know about?