syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me

Question:
From Bash how to run 1 Lua command?

An obvious way to do this is to put the Lua command in a my.lua and then run the shell command: lua my.lua

Another way is to use the dash-e option with lua:
lua -e "print(7/8)"
This might be useful if I want to use Bash as glue between Lua and others:
dan@hp ~/ks/b/lua $
dan@hp ~/ks/b/lua $ lua_output=`lua -e 'print(7/8)'`
dan@hp ~/ks/b/lua $
dan@hp ~/ks/b/lua $ ruby_output=`ruby -e 'p(8.0/7)'`
dan@hp ~/ks/b/lua $
dan@hp ~/ks/b/lua $ python_output=`python -c "print($lua_output + $ruby_output)"`
dan@hp ~/ks/b/lua $
dan@hp ~/ks/b/lua $ echo $python_output
2.01785714286
dan@hp ~/ks/b/lua $
dan@hp ~/ks/b/lua $


syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me