I have an executable I want to run using Lua ... how do I do this?
Can't seem to find any documentation anywhere about this.
asked May 13, 2010 at 18:50
4 Answers 4
You can use Lua's native 'execute' command.
Example:
os.execute("c:\\temp\\program.exe")
Sources: Lua Guide / os.execute
Judge Maygarden
27.7k9 gold badges86 silver badges101 bronze badges
answered May 13, 2010 at 18:56
-
Nearly double-posted with interjay! Ha! At least we both said the same thing! Cheers.Anthony M. Powers– Anthony M. Powers2010年05月13日 18:57:24 +00:00Commented May 13, 2010 at 18:57
-
Thank you for a clear and simple example that demonstrates the concept in a way that can be easily grasped immediately upon inspection.User.1– User.12014年02月04日 21:05:27 +00:00Commented Feb 4, 2014 at 21:05
If you need the output of the program, use io.popen
answered May 14, 2010 at 2:21
For someone who need using io.popen
local openPop = assert(io.popen('/bin/ls -la', 'r'))
local output = openPop:read('*all')
openPop:close()
print(output) -- > Prints the output of the command.
answered Sep 21, 2021 at 0:57
Use os.execute
.
answered May 13, 2010 at 18:56
lang-lua