Ralph wrote: ↑
Thu Apr 22, 2021 6:12 pm
The Lua organisation has their own book:
It's pretty good. You can do a lot of complex things with Lua. I'm probably applying just 1% of its capabilities
The one thing I can say (IMHO of course) is that the 'book' is probably the worst ever programming guide I have ever seen
I think this is the major reason that LUA has never taken off as a programming language - it has flat lined - nt as in dead - but as in neither growing nor diminishing.
I always loved this example. Page 1 ....
Normal practice for most languages is to gently bring the user on board and slowly expand on the basics..... ' Hello World' is ubiquitous as the very first 'program' Then slowly introduce other aspects in a gradual way presuming the user has little experience ..
yet - this is the LUA approach, obviously written by super geek programmers who have no idea how to create instructional guides and simply cannot relate to a level that is appropriate for the beginner - even with some previous experience.
1 – Getting Started
To keep with the tradition, our first program in Lua just prints "Hello World":
If you are using the stand-alone Lua interpreter, all you have to do to run your first program is to call the interpreter (usually named lua) with the name of the text file that contains your program. For instance, if you write the above program in a file hello.lua, the following command should run it:
prompt> lua hello.lua
As a slightly more complex example, the following program defines a function to compute the factorial of a given number, asks the user for a number, and prints its factorial:
-- defines a factorial function
function fact (n)
if n == 0 then
return n * fact(n-1)
print("enter a number:")
a = io.read("*number") -- read a number
If you are using Lua embedded in an application, such as CGILua or IUPLua, you may need to refer to the application manual (or to a "local guru") to learn how to run your programs. Nevertheless, Lua is still the same language; most things that we will see here are valid regardless of how you are using Lua. For a start, we recommend that you use the stand-alone interpreter (that is, the lua executable) to run your first examples and experiments.
From hello world to WTF ! ????????????????? on the same page.
It means 'something' to me - I am lucky to have some good programming experience over the years with several differing languages both low and high level - beginning with Z80 assembler - however, as an instructional guide, it really is a total abortion.
It is like a driving instructor telling you where the handbrake and pedals are - then expecting controlled power slides and reverse J turns without even showing the student how to start the effing car or giving you the keys !.
IT REALLY is bad in the way of guiding a new user into LUA. It is sort of like getting a book on rocket science that expects you to be a rocket scientist to read it...............
THE worst example I have ever seen.