Forum

> > CS2D > Scripts > Learning Lua? First learn about computers...
Forums overviewCS2D overview Scripts overviewLog in to reply

English Learning Lua? First learn about computers...

17 replies
To the start Previous 1 Next To the start

old Learning Lua? First learn about computers...

Lee
Moderator Off Offline

Quote
The biggest hurdle of learning programming (in general) is that you will invariably become too bogged down by the syntax of the language that you no longer care why the language was designed the way it was. Programming languages have a tendency to evolve into complexity. While outwardly, dynamic languages may seem more simplistic than their predecessors such as C, the design of the language itself is becoming more involved. So please familiarize yourselves with the following:

1. Computers are dumb machines. They're not smart. When left to their own, they can't do anything meaningful.

2. All computer programming languages are confined by certain invariants imposed by the computer itself.

With that said, if you can look through the syntax of a language, you'll begin to see patterns in the design of the language.

Why do functions in Lua have to be closed off with end?
Because a computer doesn't know when it is suppose to stop execution.

Why do we need tables if we can just have unlimited number of variables?
Because tables provide a container for both current and future data.

Why does Lua pass in tables by reference? And why does {1,2,3} == {1,2,3} return false? What are the uses for metatables? And why in god's name is it so hard to understand Lua?

These can only answered through intellectual curiosity, because an answer in itself is an abstract notion without implementation, or an implementation without conceptualization. It's then crucial to start off from the beginning in order to learn how to use Lua. The beginning being recognition that computers are stupid, and that yelling at it to make you a sandwich will have absolutely no effects.

A gentle introduction to how programmers view computers: http://www.phailed.me/2011/02/computers/#desc

old Re: Learning Lua? First learn about computers...

Banaan
User Off Offline

Quote
One warning to all of you:

Be absolutely sure you want to waste your time with trying to understand it all, because once you start trying, you won't find a place to stop for the next 23 years.

Nice explanation in a classic Lee style (great simplistic and functional layout, pretty understandable and nice to read).

But is it really that hard to understand Lua? I think there are thousands of things harder to understand.

nice reference to xkcd

old Re: Learning Lua? First learn about computers...

DannyDeth
User Off Offline

Quote
You guys have a vital point here, but another tip would be this:
If you are failing your classes in school ( a lot of people here still seem to be in school to me ), then don't try to perfectly understand a programming language.
Everything a computer does is technically mathematical/arithmetical, so if you can't understand a word your math teacher says to you while explaining why 2x/x + 7y/9x = 2x + 7y/9x^2, wait until you are older/more ready to learn. Otherwise you will be in the deepest shit ever ( hence "it will take you 39 years" thing ), and yes, even deeper than when you sexually-harrased that fat girl last term.

old Re: Learning Lua? First learn about computers...

Lee
Moderator Off Offline

Quote
To people with previous programming experiences, Lua is a wonderfully simplistic language. If you actually take a look under the hood, you'll see how elegant the language was implemented by its creators. (If you have some free time, take a look at its architecture, especially the VM, the design is really "arcane" with respect to other language implementations but you can see how much time was put into its design rather than implementation).

To people who've never programmed previously however, the necessity to encapsulate abstract notions in some quantitative form is really hard to understand, hence it's usually difficult to catch on right away. By understanding that a computer is nothing more than a calculator, and that all computations are delegated to binary arithmetic, people can start off with the assumption that they'll need to somehow decompose higher abstractions (the notion of a player, or even any unenumerable object) into physical quantities (the position of the player and the angle) in order to write successful programs.

But yeah, it's more or less a conditioned way of thinking so if do so only if you plan on programming for a while or if you foolishly believe that you can resist the urge to satisfy more of your intellectual curiosity (you know what they say, programming is like sex)

One thing to take away: When good programmers attempt to write code, they scratch their heads and think for a long time before they even touch the keyboard.

old Re: Learning Lua? First learn about computers...

Lee
Moderator Off Offline

Quote
heh, I'm pretty sure that that qualifies you as a good programmer already

The internet has been very humbling actually, I am now convinced that I am a horrible programmer, and for good reasons too. I guess we all strive to be mediocre in the end.

old Re: Learning Lua? First learn about computers...

JONY
User Off Offline

Quote
Calculation power of human being will never reach to computers', but computers can only be as smart as the programmer wants it to be.

As Lee said, it's very good to think through the logic of your program, before writing it. Although, if you are not sure (but have some kind of idea) how to do it then the best way will be "try and error method", if you know what I mean. Syntax and semantics - two major things you should learn about prog. language.

old Re: Learning Lua? First learn about computers...

DannyDeth
User Off Offline

Quote
Well, I don't sit and scratch me head for a long time, but I do try and think of the possible ways to create whatever I would like to do before I actually start doing it

So that means I'm a bad coder...
"Fuck! My life's work has be compromized!"

old Re: Learning Lua? First learn about computers...

Jaso
BANNED Off Offline

Quote
You are also an lazy asshole dude who even didnt take time to check what i just wrote or you must be blind i think you just cant see what i wrote maybe something is wrong in your facking head

old Re: Learning Lua? First learn about computers...

DannyDeth
User Off Offline

Quote
Off-topic: ( sorry, mods/DC )
@jaso55
I'm sorry, but do you actually think that I'm threatend by your little childish temper tantrums? I couldn't read what you posted, you cannot speak English like that and expect people to be able to read it easily, my eyes were just darting everywhere. There were no tabs, paragraphs or punctuation marks. Just get over it already.

old Re: Learning Lua? First learn about computers...

DannyDeth
User Off Offline

Quote
That is 100% true Jony, Like Lee pointed out to me:
1
parse("setpos "..T_spot[x].." "..T_spot[y])
I couldn't for the life of me find out why it wasn;t working, then Lee points out:
1
2
3
T_spot['x']
or
T_spot.x
And that was when I realised that the tables in Lua are pretty much both dictionaries and lists at the same time, so if you want to access 'x' in T_spot, one must actually type ['x'], otherwise it tries to access the place in the array that contains the same thing as x, and x doesn't exist. ( Thnx to Lee for pointing that out, didn't reply on thread )
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview