I have a Lua program in a file:
$ cat three.lua
for i = 1, 3 do print(i) end
It runs great with Lua 5.3:
$ lua three.lua
1
2
3
But I cannot run it on the command line with -e:
$ lua -e 'for i = 1, 3 do print(i) end'
lua5.3: (command line):1: <name> expected near <eof>
Simpler programs work fine with -e:
$ lua -e 'print("Hello");print("World")'
Hello
World
It seems Lua's script building -e does not like the structured for statement with the terminating end. What am I doing wrong?
brew install luadoes NOT install Lua 5.3! ARRRRRGGGHHH. So you have tobrew install lua5.3, which makes an executable calledlua5.3(NOTlua!!!). Because I found this awful, I made my ownluascript that invokes lua5.3. But I made it wrong. I made it saylua5.3 $@instead oflua5.3 "$@". So it was not Lua's fault, but mine. I'm still very disappointed with the maintainers of Lua homebrew formula, but I'm sure they had their reasons, which were more important than my own desires. - Ray Toal