Best practices and coaching

Help creating logic scripts for Air Manager Instruments

Moderators: Ralph, russ

User avatar
Keith Baxter
Posts: 2887
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Best practices and coaching

#11 Post by Keith Baxter » Thu Apr 22, 2021 6:18 pm

Ralph wrote:
Thu Apr 22, 2021 6:12 pm
I'm probably applying just 1% of its capabilities :)
20% more than me. :D

AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Posts: 755
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Best practices and coaching

#12 Post by jph » Fri Apr 23, 2021 9:55 am

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 :o :shock: :( :roll: :lol:
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. :shock: :lol:
1 – Getting Started
To keep with the tradition, our first program in Lua just prints "Hello World":

print("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 1
return n * fact(n-1)

print("enter a number:")
a ="*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 !. :? :shock: :roll: :D

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.

“Everything in moderation, including moderation.”
“Experience is merely the name men gave to their mistakes.”
Joe (CISSP) -IT security consultant

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests