Simple Command Line Script Execution

lua-users home
wiki

To Execute a script from the command line, e.g from a NSLU2 running openWrt Kamikaze 8.09rc2 with Lua in the path:

$ echo "print(\"Hello, World\")" > test.lua
$ lua test.lua

The result is:

Hello, World

Another way for simple code is to pipe the script directly into Lua:

$ echo "print(\"Hello, World\")" | lua

The output is the same.


RecentChanges · preferences
edit · history
Last edited December 22, 2018 11:41 pm GMT (diff)