41 posts
Posted 13 January 2016 - 08:56 PM
When calling os.run with the global table, I get a "loop in gettable" error.
How would I use it with the global table?
Edited on 14 January 2016 - 08:03 PM
89 posts
Location
USA
Posted 13 January 2016 - 09:01 PM
are you trying to pass _G through os.run so the program can use it?
7083 posts
Location
Tasmania (AU)
Posted 14 January 2016 - 12:29 AM
… if so, don't. They have access to it anyway. Either make a new environment table, or, if you want to run the script using the same environment as the shell you're using, use
shell.run() instead.
41 posts
Posted 14 January 2016 - 04:15 PM
They have access to it anyway.
I've tried passing it an empty table, but that doesn't work, they don't have access to global environment variables previously set in the same program (and that's also a relief for sandboxing).
Edited on 14 January 2016 - 03:16 PM
1140 posts
Location
Kaunas, Lithuania
Posted 14 January 2016 - 06:11 PM
Why are you using os.run instead if shell.run? If you can, you should be using shell.run, as it runs the programs in a proper environment. The global variables of programs are stored not in the _G table but rather in the shell's program environment, so to get that the best way would be to use shell.run.
2427 posts
Location
UK
Posted 14 January 2016 - 06:23 PM
41 posts
Posted 14 January 2016 - 09:03 PM
Thank you Lupus but I already know what each one does. I've solved the problem by assigning all the global variables I want to pass down to a key in a table, which I then pass in to os.run/