mix lua.eval (Lua v1.0.0-rc.1)

View Source

Evaluates 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

Examples

$ echo "return 1 + 2" | mix lua.eval -
[3]

$ mix lua.eval test/fixtures/returns_value.lua
[5]