Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Rimmel on May 30, 2022, 07:43:57 AM

Title: LUA issue operating system command
Post by: Rimmel on May 30, 2022, 07:43:57 AM
Is there a way to get the lua to issue an operating system command. e.g. start another program?

thank you
Title: Re: LUA issue operating system command
Post by: joeaverage on May 30, 2022, 07:52:40 PM
Hi,
you really like to to tackle the hard stuff don't you?

https://www.lua.org/manual/5.3/manual.html#6.9 (https://www.lua.org/manual/5.3/manual.html#6.9)

Code: [Select]
os.execute ([command])
This function is equivalent to the ISO C function system. It passes command to be executed by an operating system shell. Its first result is true if the command terminated successfully, or nil otherwise. After this first result the function returns a string plus a number, as follows:

"exit": the command terminated normally; the following number is the exit status of the command.
"signal": the command was terminated by a signal; the following number is the signal that terminated the command.
When called without a command, os.execute returns a boolean that is true if a shell is available.

Craig