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

How to run programs in the background?

Started by houseofkraft, 21 September 2016 - 10:15 AM
houseofkraft #1
Posted 21 September 2016 - 12:15 PM
Hi Guys!

I want to run a program in the background. If i use the bg command then it will run in the background but it will have a tab. I want to run a program in the background without that tab showing up. It would be very useful for different things. Like for my WIP Alarm System i can make it so on my CC PC it will notify me when an intruder enters.

Thanks!
H4X0RZ #2
Posted 21 September 2016 - 01:07 PM
The easiest way to handle this is to just accept the tabs. They won't kill you.

Otherwise you could run a TLCO (Top Level Coroutine Override) and add your alarm to the coroutine "stack", next to multishell and rednet.run.
Lupus590 #3
Posted 21 September 2016 - 02:33 PM
or you could have your program create a shell instance under it. like vncd does.
Sewbacca #4
Posted 21 September 2016 - 08:35 PM
The easiest way to handle this is to just accept the tabs. They won't kill you.

Otherwise you could run a TLCO (Top Level Coroutine Override) and add your alarm to the coroutine "stack", next to multishell and rednet.run.

Note that TLCO won't work in Lua 5.2.
H4X0RZ #5
Posted 21 September 2016 - 08:49 PM
The easiest way to handle this is to just accept the tabs. They won't kill you.

Otherwise you could run a TLCO (Top Level Coroutine Override) and add your alarm to the coroutine "stack", next to multishell and rednet.run.

Note that TLCO won't work in Lua 5.2.

Why?
Sewbacca #6
Posted 21 September 2016 - 08:52 PM
The easiest way to handle this is to just accept the tabs. They won't kill you.

Otherwise you could run a TLCO (Top Level Coroutine Override) and add your alarm to the coroutine "stack", next to multishell and rednet.run.

Note that TLCO won't work in Lua 5.2.

Why?

TLCO is based on setfenv and getfenv, functions that will be removed in Lua 5.2, so it will be impossible to hack that, except bios would provide a setting to enable running startup on top.
Edited on 21 September 2016 - 06:52 PM
Lyqyd #7
Posted 21 September 2016 - 09:58 PM
This simply isn't true. It is not helpful to spread misinformation.
Sewbacca #8
Posted 21 September 2016 - 10:26 PM
Sorry, i thought i edited my post after a few minutes, but it seems that it didn't worked:
EDIT:
See posts #4 - #6.

Also, i couldn't know, that it is possible without getfenv and setfenv. I just don't saw any other possibility.

Sewbacca
Edited on 21 September 2016 - 08:33 PM