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

How do I add global code?

Started by WarriorDB, 15 June 2014 - 05:29 AM
WarriorDB #1
Posted 15 June 2014 - 07:29 AM
I'm trying to figure out how to make inputs global, so if I was in another program I could say use it. For ex: I make a program in which my password = pie, in another program I want to login with that, how do I bring it over without copying the code?
theoriginalbit #2
Posted 15 June 2014 - 07:30 AM
anything you define without the local keyword is in the global space.


foo = "bar" --# global space
local bar = "foo" --# local/program space
WarriorDB #3
Posted 15 June 2014 - 07:38 AM
Also do you know how to constantly have a program running while also being able to say edit other programs?
Bomb Bloke #4
Posted 15 June 2014 - 08:35 AM
The coding is complex, but if you have ComputerCraft 1.6 or later, that provides a pre-made script for doing so called multishell.

If you don't have 1.6, then I'd recommend just placing down a second computer.