开发者

How do I run an executable using Lua?

开发者 https://www.devze.com 2022-12-30 09:11 出处:网络
I have an executable I want to开发者_StackOverflow run using Lua ... how do I do this? Can\'t seem to find any documentation anywhere about this.You can use Lua\'s native \'execute\' command.

I have an executable I want to开发者_StackOverflow run using Lua ... how do I do this?

Can't seem to find any documentation anywhere about this.


You can use Lua's native 'execute' command.

Example:

os.execute("c:\\temp\\program.exe")

Sources: Lua Guide / os.execute


If you need the output of the program, use io.popen


Use os.execute.


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.
0

精彩评论

暂无评论...
验证码 换一张
取 消