local prg = fs.open("program", "r")
local stuff = loadstring(prg.readAll())
stuff()
how could I pass the command arguments to a program loaded this way? Or is it impossible?
loadstring() questions
Started by KingofGamesYami, May 17 2014 03:18 PM
3 replies to this topic
#1
Posted 17 May 2014 - 03:18 PM
lets say I have a program that needs command arguments. It's saved as "program" (yes I know thats a lame name)
#2
Posted 17 May 2014 - 05:13 PM
Why not use shell.run() ?
#3
Posted 17 May 2014 - 06:07 PM
The program I am making... is complicated. https://github.com/K...is/waypoint.lua
Anyone that wishes to contribute can make a pull request
Anyone that wishes to contribute can make a pull request
#4
Posted 17 May 2014 - 06:14 PM
local prg = fs.open("program", "r")
local stuff = loadstring(prg.readAll())
prg.close()
stuff({ "arg1", "arg2" })
Not sure whether that would work but it makes sense to me. Also, you should always close your files. The garbage collector does take care of it but it takes a while for it to take care of it.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











