Jump to content




How did you learn Lua?

lua computer turtle

17 replies to this topic

#1 mrpoopy345

  • Members
  • 148 posts
  • LocationMy Computer

Posted 26 November 2013 - 07:51 PM

I am not sure this is in the right section, but I posted it here because I am indeed asking a pro.
So, how did you learn Lua? Could you give links, videos, etc. because I am really trying to get into Lua, and I do not really know how.
Thanks!

#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 26 November 2013 - 10:09 PM

The number 1 thing to remember... Google is your friend. If you feel you don't know how to use Google well enough, or could use it better, read this.

Personally I did 3 things:
1. I read the PIL
2. I read a few of the pages on lua-users.org.
3. I read other people's code and played around with it seeing what different things did and how the changes I made effected the program

#3 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 27 November 2013 - 02:40 AM

Also, when you learn something from the above links, mess around with it. For instance I'm currently learning java and got quite far by reading tutorials and mess around with it, if you use it you will remember it faster.

And I want to underline, like theoriginalbit, Google is your friend!

#4 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 27 November 2013 - 02:44 AM

View PostEngineer, on 27 November 2013 - 02:40 AM, said:

And I want to underline, like theoriginalbit, Google is your friend!
Its ok, I'll underline it for you :P

#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 27 November 2013 - 05:27 AM

I learn by performing web searches on commands I know from other languages, along with the term "Lua". For the most part that gets me pages from the sites TheOriginalBIT linked above.

Be aware, though, that not all commands will work the same in ComputerCraft as they're documented on those sites - their names or effects may vary. If a command has any documentation on the CC wiki, then pay attention to what that has to say.

Probably the largest percentage of what I've learned comes from reading forum posts in this board section. It's common to see people throwing out comments like "by the way, you could take this block of code and do the same thing faster and easier with this one", and that knowledge is very valuable - it's difficult to look up stuff about coding concepts if you don't even know those options exist, but simply reading manuals cover to cover tends not to reveal the most useful stuff very quickly.

Once I have a command, if I'm still unsure exactly how it behaves I'll write a short script for the sole purpose of playing with it. Passing it random-ish variables and confirming I get back the results I expect.

How I originally learned to program, however, was via library books - Usborne in particular, and about a year ago I even ordered some of the books from that series just for the sake of having them. Heh. Maybe I should try and get Island of Secrets running in ComputerCraft.

Once computing moved on a bit and Windows became more popular, I shifted to QBasic. There were not nearly as many interesting books on that language, and this was before internet access was common in the home, but the IDE includes a working code example for pretty much every command - you could literally type in "if", right click that word, and instantly get a page or two of info on it along with a commented example program (filled with other commands that you may or may not know, but could also right click, and so on...).

Eventually I started on Java. Still without much in the way of internet access, it was again just a case of relying on the official documentation of the language, but by then I was mostly just translating commands & concepts I already knew into a slightly different dialect. These days, when working with a language I'm not familiar with it's web searches all the way, command by command. Typically the first search is to determine what the "does not equal" sign is... <>, !=, ~=, I don't see why there are so many variants...

See, most higher-level languages look the same, at a glance - once you've got a semi-decent knowledge of a few (... and an internet connection), you can quickly learn to produce working code (not always "good" code, but "working") for just about any of the others.

Bah. You've got me rambling now.

#6 Inumel

  • Members
  • 120 posts

Posted 27 November 2013 - 05:56 AM

I learned LUA for the sole purpose of CC, and while I may not be nearly as good as some of the faces here, I can get my way around fairly easily.. Sadly I cannot offer more than what the previous people have offered, I can only suggest you skim the Ask a Pro forum

Edited by Elgriton, 27 November 2013 - 05:58 AM.


#7 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 27 November 2013 - 06:53 AM

View Posttheoriginalbit, on 27 November 2013 - 02:44 AM, said:

View PostEngineer, on 27 November 2013 - 02:40 AM, said:

And I want to underline, like theoriginalbit, Google is your friend!
Its ok, I'll underline it for you :P/>
It was more of an expression :P

To still stay on topic, I want to say that experience is the best way of learning. That is because you come up with code that is more efficient than you had, so you remember the better code, to say it like that.

Also I want to say that you can certainly ask questions, but do your research first! Because there are a lot of questions which can be solved by a simple Google search.

#8 Zudo

  • Members
  • 800 posts
  • LocationUK

Posted 27 November 2013 - 12:08 PM

I saw ComputerCraft in Tekkit, read the wiki, joined the forums, won.

Edited by ZudoHackz, 27 November 2013 - 12:08 PM.


#9 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 24 April 2016 - 03:25 PM

View PostBomb Bloke, on 27 November 2013 - 05:27 AM, said:

How I originally learned to program, however, was via library books - Usborne in particular, and about a year ago I even ordered some of the books from that series just for the sake of having them. Heh. Maybe I should try and get Island of Secrets running in ComputerCraft.

Seems you can now download these as free PDFs from Usborne's own website, as of a couple of months ago. Totally out of date in the modern coding era, but still totally worth a look!

#10 Morganamilo

  • Members
  • 12 posts

Posted 25 April 2016 - 10:11 AM

This is the first thing I ever made in lua http://pastebin.com/NmyG5Vxa
I pretty much just worked on it for a couple of days until it worked.

#11 Dragon53535

  • Members
  • 973 posts
  • LocationIn the Matrix

Posted 25 April 2016 - 11:38 AM

I suppose if we're talking in this 2 year old thread...

I learned Lua just by playing modded minecraft with CC on it. I wanted to do something, and I tried until I could make it.
I also tried to make everything portable between different computers, so I had to learn tables (which really isn't hard at all, I don't understand how people can't figure them out), I made sure that I wrapped each peripheral correctly, I made sure that each and every single thing I had would be fine without human interaction and not wanting to force someone if they used my code to change parts of the source itself. (Although I did start out that way).

I had a few railcraft ranks I wanted to monitor, I made a program. I wanted to make sure that each tank when it got full or empty, had a system in place that it would message the other computers I connected to either drain or fill the tanks. I expanded my program and learned a bit of rednet along the way.

I wanted to know which buttons on the Tardis mod I've used to save to, I made a button display.

I wanted a message system for me and the person I shared my base with to communicate easier without having to worry about making down or placing signs, I made a message system.

Any other thing I learned about Lua I did by just either lurking, or helping out here in the AaP section or of course ASKING in the AaP section. (Yay patterns, or as I much more commonly call them Regular Expressions)


Nowadays I go to college for a game design programming degree though, so no more Lua really for me. However it sort of opened my eyes to how much Lua is different from other languages and how much I like C# more than Lua or most other languages. Also it showed me that both I don't know everything, and that ternary is done quite a bit different in other languages :P

Edited by Dragon53535, 25 April 2016 - 11:45 AM.


#12 Luca_S

  • Members
  • 407 posts
  • LocationGermany

Posted 25 April 2016 - 07:43 PM

If learned Lua by watching some vids and looking at docs. Later(when I found out there were the forums/multiplayer servers) I started to annoy other people with questions and now I think I kinda learned it :P

#13 Rougeminner

  • Members
  • 151 posts

Posted 29 April 2016 - 05:36 PM

I found computercraft and started learning Lua so i could mess around with it, then i found out how to install it on my mac and from that point forward i decided that i would learn it fully for the purpose of messing around on my mac. its my hobby. I learned Lua by trial an error in retrospect i should have found a better way to learn but it was fun and i got the need to knows down.

#14 EveryOS

  • Members
  • 570 posts
  • LocationOver there ->

Posted 29 April 2016 - 06:12 PM

Here, here, and here

#15 Anavrins

  • Members
  • 775 posts

Posted 29 April 2016 - 07:20 PM

Started in early 2013 by playing on a FTB server that I was moderating, first ever thing I made was a crude cobblegen with a turtle.dig loop.
After the server closed, I started playing more seriously with CC on a singleplayer world, making many classical "first programs" like doorlocks, screensavers, remote controlled turtles, etc...
I pretty much learned by trial and error with the help of the CC wiki.

#16 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 29 April 2016 - 08:31 PM

View PostEveryOS EveryPlatform, on 29 April 2016 - 06:12 PM, said:

Here, here, and here

Why Lua 5.3? As far as I remember, CC uses 5.1.

Edited by Creator, 29 April 2016 - 08:31 PM.


#17 EveryOS

  • Members
  • 570 posts
  • LocationOver there ->

Posted 29 April 2016 - 08:52 PM

Just cas' I felt like being up ta date

#18 lieven121

  • Members
  • 14 posts
  • Locationsomewere in Belgium

Posted 01 May 2016 - 12:53 AM

View Postmrpoopy345, on 26 November 2013 - 07:51 PM, said:

I am not sure this is in the right section, but I posted it here because I am indeed asking a pro.
So, how did you learn Lua? Could you give links, videos, etc. because I am really trying to get into Lua, and I do not really know how.
Thanks!
I only know lua as the cc lua no vanilla and I learned that trough:
experimenting
looking at other code
and watch dire his vids and also funshine
and if you don't get how something works or how you could do something you can always ask a pro or ask me
maybe look into computecraft edu





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users