15 posts
Posted 22 May 2012 - 07:49 PM
How do I code a program to start another program?
I don't know much code sorry
146 posts
Location
the Netherlands
Posted 22 May 2012 - 08:06 PM
shell.run("programname", "argument1", "argument2"..)
1604 posts
Posted 22 May 2012 - 08:07 PM
You can use shell.run("program", "arg1", "arg2", …). Just don't use it to start your own program or just to run "clear" or something like that (you can, but it's not good to do it).
146 posts
Location
the Netherlands
Posted 22 May 2012 - 08:08 PM
shell.run("programname", "argument1", "argument2"..)
P.s. you should have posted this in the ask a pro forum, not in the tutorials.
15 posts
Posted 22 May 2012 - 08:11 PM
thanks, I felt like an idiot asking there before and I thought that maybe other people had this problem and they would benefit from it being here… sorry
What are the arguments? What do they do?
1604 posts
Posted 22 May 2012 - 08:17 PM
Arguments are like when you type in the shell, for example, "edit test". "edit" would be the program name and "test" would be an argument. You can use them to make your program so it does different stuff depending on the arguments, or receive a file name so you don't have to ask for it later, etc.
6 posts
Posted 14 June 2012 - 09:51 AM
You can use shell.run("program", "arg1", "arg2", …). Just don't use it to start your own program or just to run "clear" or something like that (you can, but it's not good to do it).
Quick question–why shouldn't one use shell.run to run their own programs?
I currently have a few programs running progressions like:
-ultimate.program
–shell.run
—my.program
—-shell.run
—–pre.programmed
so far, I've seen no problems, but are you implying that there can be? If so–what problems?
I did it this way 1) to keep the code short and clean 2) out of laziness…lol
2447 posts
Posted 14 June 2012 - 01:23 PM
What they mean is don't run the same program that you are running from that program - otherwise you'll end up filling up the Lua stack - which has a depth limit of 256.
6 posts
Posted 14 June 2012 - 07:35 PM
What they mean is don't run the same program that you are running from that program - otherwise you'll end up filling up the Lua stack - which has a depth limit of 256.
So don't do something like:
-my.program
–shell.run
—my.program
?
That seems kinda stupid to me anyway xD why not just run a loop?
The program I spoke of before I wrote to turn on/off outputs in RP2, and included higher programs to run multiples of these basic programs (faster than typing redset…. a million times).
2447 posts
Posted 14 June 2012 - 08:14 PM
Precisely - it's stupid because there are loops purely for that reason :(/>/>
6 posts
Posted 14 June 2012 - 10:37 PM
Precisely - it's stupid because there are loops purely for that reason :)/>/>
Thanks for the help. I'm new to CC and Lua and was worried that this might make my code crash, lol. I'm getting pretty good at it tho :(/>/> I've heard Lua has a fast learning curve, that coupled with the fact that I'm a naturally fast learner means that I got this stuff down in less than a week, lol.