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

Better os.run()

Started by greygraphics, 20 June 2016 - 03:59 PM
greygraphics #1
Posted 20 June 2016 - 05:59 PM
Hey,

I recently discovered the os.run() command and I was wondering why there is only a way to add apis but not disable them. Maybe that would be cool?
apemanzilla #2
Posted 20 June 2016 - 06:13 PM
Hey,

I recently discovered the os.run() command and I was wondering why there is only a way to add apis but not disable them. Maybe that would be cool?

You can do something like this:

os.run({ api={} }, "program")
greygraphics #3
Posted 21 June 2016 - 03:43 PM
Hey,
I recently discovered the os.run() command and I was wondering why there is only a way to add apis but not disable them. Maybe that would be cool?
You can do something like this:

os.run({ api={} }, "program")

Thank you for your answer, I will try this as soon as possible. I found a different solution though:

local env = {['os']=new api}
os.run (env,program)
Edited on 21 June 2016 - 01:43 PM
apemanzilla #4
Posted 21 June 2016 - 03:44 PM
Hey,
I recently discovered the os.run() command and I was wondering why there is only a way to add apis but not disable them. Maybe that would be cool?
You can do something like this:

os.run({ api={} }, "program")

Thank you for your answer, I will try this as soon as possible. I found a different solution though:

local env = {['os']=new api}
os.run (env,program)

That's exactly the same thing though…
greygraphics #5
Posted 21 June 2016 - 08:03 PM
Hey,
I recently discovered the os.run() command and I was wondering why there is only a way to add apis but not disable them. Maybe that would be cool?
You can do something like this:

os.run({ api={} }, "program")

Thank you for your answer, I will try this as soon as possible. I found a different solution though:

local env = {['os']=new api}
os.run (env,program)

That's exactly the same thing though…

Is it? I am not that experienced with lua,
apemanzilla #6
Posted 21 June 2016 - 09:08 PM
Is it? I am not that experienced with lua,

It's the same thing, you're just defining it as a variable instead - here's an example of what i mean


local myVar = "hello"
print(myVar)
--# is the same as
print("hello")
Edited on 21 June 2016 - 07:08 PM
theoriginalbit #7
Posted 22 June 2016 - 09:48 AM
Moved to Ask a Pro