reteyez 0 Posted March 30, 2016 Share Posted March 30, 2016 Is it possible to require a libary within a file which then executes another file and passes the required libary to it? Quote Link to post Share on other sites
0 Gangsir 14 Posted March 31, 2016 Share Posted March 31, 2016 Simple. Just require the library as usual, ex local lib = require("myLib") Then, use os.execute to run another program, and pass the library variable,(lib), to the executing script, like so: local lib = require("myLib") os.execute("otherprogram.lua lib") Of course, you will need to receive and reassign the variable in the executed program. Plus, this only works on the same computer, (ie, both programs on same computer), and the first program will suspend until the program inside os.execute yields. As a side note, why do this? Why not just put require in each of the programs? Quote Link to post Share on other sites
0 reteyez 0 Posted April 1, 2016 Author Share Posted April 1, 2016 I tried os.execute before but I didn't got that argument right, Now I know, thanks. Anyhow I went with dofile instead and it suits more my needs. If you want to know why this whole trouble: https://oc.cil.li/index.php?/topic/871-require-recursion/ Quote Link to post Share on other sites
Is it possible to require a libary within a file which then executes another file and passes the required libary to it?
Link to post
Share on other sites