I hope that this thread is suitable and helpful and not a waste of forum space. I’ve started the lua lectures, and have a few stumbling blocks in understanding them, due to my complete lack of familiarity with computer science and programming… so, if I may start out? And please advise where I might ask, if not here!
Here’s some questions having read the first set of lecture notes on lua (I did not understand the slide on simplicity at all but will leave that for now). Forgive me if I seem super foolish.
I found the wikipedia articles often used examples of e.g. ‘execution model’ rather than a complete defitnion. So, from the 1st lecture:
scripts are “programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator.”
But what is a runtime environment? “Runtime system behavior is, arguably, defined as any behavior not directly attributable to the program itself” so does that simply mean that lua, being a scripting language, is written for something (what?) that is not controlled by lua?
I understand that an API is like a GUI for programmers. So it’s an interface, for use by the programmer, right? What does this mean, can I e.g. have a screengrab of what it can look like?
Questions about the meaning of some specific statements in the slides:
“The Lua interpreter is a library for C programs” does this mean that lua is interpreted, the code executed without being compiled first, by a library that is part of C?
“Programs in other languages can easily consume the API” does this mean that other languages (C#, perl) can be used by the programmer as she her interfaces with the API?
From the 2nd lecture:
I am using eclipse, and trying to create a file defs.lua for use with the REPL for a project “Starting out”. But after starting that project and entering in main the code
local function main()
and creating a new file defs.lua (apparently saved as “Starting out/src/defs.lua”) with the code
if n < 2 then
return n * fact(n-1)
I get an error message when I run main.lua, saying that no such file as defs.lua. How am I using eclipse wrong?
And what is the word for the variable between brackets, is it an “argument” for the function?