mix lua.eval (Lua v1.0.0-rc.1)
View SourceEvaluates a Lua source file in a fresh Lua.new() VM and prints
any return values.
Usage
mix lua.eval path/to/script.lua
echo "return 1 + 2" | mix lua.eval -Pass - as the path to read source from stdin. Anything Lua's
built-in print() writes goes to stdout normally; the task's
printed return values appear after that.
Options
--source NAME— Source name shown in runtime errors (default: the basename of the file, or<stdin>when reading from-).
Exit codes
0— script ran to completion (even if it returned nothing).1— script raised aLua.CompilerExceptionorLua.RuntimeException. The error message is written to stderr.
Examples
$ echo "return 1 + 2" | mix lua.eval -
[3]
$ mix lua.eval test/fixtures/returns_value.lua
[5]