开发者

How do I run an executable using Lua?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜