os.execute ([command]) |
Cの関数 system と等価。
command はOSのシェルによって実行されるコマンドを渡す。 システムに依存するステータスコードを返す。 command を省略すると、シェルが利用可能ならゼロ以外を返し、そうでなければゼロを返す。
シェルが利用可能なら、ping を実行して結果を表示する。
-- ping if os.execute() == 1 then code = os.execute("ping google.com") print("code:"..code) else print("sorry, could not execute") end