My current solution works by getting the environment from the startup program (where shell is available) using getfenv, making it available to the menu program by using os.run, and then passing it back and forth so it can be accessed by the function I use to load programs when neccessary.
Is there a way to get access to the shell api from the fileloading function without passing the appropriate environment as a function parameter? One possibility: I know I can get the environment from different stack levels, for example, getfenv(2) gets the environment that called the current function (as I understood it. I just don't know how to determine the *first* caller.
Thanks for your help. Please let me know if you need clarification and I will edit my question!