lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 2/28/2018 3:46 AM, Glenn Travis wrote:
I was messing around with this:

f = function  (op, a, b)
 if  op =='add'  then
  return  a + b
 elseif  op =='sub'  then
  return  a - b
 end

[snip snip snip]
If I were on the unix shell in terminal pressing tab ‘asks’ if I want to all eleventy million commands. But why Lua wants to evidently call ls is beyond me.

Have I missed something or is this something that I will discover as I continue through the book?

Don't change anything on the terminal, shell or the Lua executable. That's solving the wrong thing.

Don't try to replicate the interactive BASIC user model of the old days. It's better to stick to something nearer to what you would do with compilers.

If any script takes more than 30 seconds to type, type it out in a nice editor, then run the file. Want to tweak the program? Edit the file and run it. I often keep a test.lua somewhere. Want to keep the file? You can give it a name based on the exercises you are doing.

Never type long things out twice. Lazy programmers (that's a good thing) find ways to save time and energy.

If you prefer a powerful editor, get ZeroBrane Studio or something like that. If not Notepad++ or its relatives are good.

--
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia