+ Reply to Thread
Page 1 of 5 123 ... LastLast
Results 1 to 10 of 43

Thread: Learning Lua

  1. #1
    Success: An illusion turck3's Avatar
    Join Date
    Jun 2007
    Location
    USA
    Posts
    1,744
    Blog Entries
    4

    Default Learning Lua

    Ok, I've asked this several times before on FP, and not once did I find an answer that I liked... so I'll ask here:

    How do you learn lua? I've tried looking at the gmod wiki for functions, but they're all either undocumented or documented horribly for anyone who hasn't used the function before (IE: needs a reminder of the parameters)

    I've read tutorials on basic lua, that doesn't trip me up...mostly... it's the actual implementation of the code that does.

    So that I don't get angry at people making posts about utter crap, allow me to say what *DONT* want to hear:
    1. The documentation *IS* bad, don't argue
    2. Don't say that I should go digging through the piles of code from other mods unless you have a concise list of them to go through, if you're going to tell me to go fetch, tell me what.

    What I'm looking for:
    1. Perhaps there *is* good documentation *ELSEWARE*, if there is, point me in the right direction.
    2. Someone willing to teach me....
    3. A list of which includes what to do and when to do it.... ie, when should I make my first swep, before or after I make _____? What should use as a base for lets say... a swep? Etc etc etc, I need something more structured than, go look at code! I need to know what code to look at and in what order and what parts are easily changable for a gmod lua newb and what is way over my head.

    Finally, as soon as I do get a grasp on the language (assuming someone here has something to say that isn't crap), I will tutorial it for future programmers

    PS: I know I got a little defensive there, but I'm just sick of the idiots over at FP telling me what I already know or crap that just isn't helpful, so excuse the tense nature of my language please.

  2. #2
    Wire Sofaking ZeikJT's Avatar
    Join Date
    Dec 2008
    Location
    California
    Posts
    1,391

    Default Re: Learning Lua

    Honestly, the best way to learn something new is to try things, make mistakes, and then seek answers. Most often the error itself will be the answer you require to revise the original code.

    It can take some deciphering sometimes or a little common sense (I tend to over think the error).
    If you absolutely NEED tutorials there are some on the (horrible?) wiki:
    Lua Tutorial Series - GMod Wiki

    I started with an idea that I wanted to realize. So I browsed through the functions available to me and just began coding. Then got frustrated how client and server are separate, but moved forward.

    Of course, if you've ever coded in anything else before this should be a sinch to pick up, lua must be one of the most forgiving and simple languages ever.

    I would advise against learning from examples, they can be helpful sometimes but it is far too easy to simply copy paste then edit it to fit your needs.

    It depends on what you want to make as SWEPs and SENTs have different setups and the files go in different locations. Tell me which one you would like to start with and I'll set up a ready to script template for you to code in when I get back from school.

    That way you won't have to deal with setting it up (the boring and stupid part) and can just start experimenting with functions.
    Against stupidity the Gods themselves contend in vain.
    -Friedrich Schiller

    The flame puts me in the mood to "Do it!".
    -Dart, Legend of Dragoon

  3. #3
    Official Bastard of Wire Jat Goodwin's Avatar
    Join Date
    Aug 2008
    Location
    Colorado Springs
    Posts
    2,771

    Default Re: Learning Lua

    You really couldn't understand any of the resources that are on garrysmod.com?
    Basic Lua - GMod Wiki

    How I basically learned it is I read much of the documentation, then went and looked at lua scripts that had similar uses to what I was trying to make to see how they did it.

    Also for how many there are? I have to say the functions are damn well documented, except some of the more obscure functions.

    The egate 2 is essentially lua, but more dumbed down.

    Also man up a bit, stop your whining, and learn to google. Of all the languages ive played with, I'll say lua is about as easy as python.
    Ö͎̗̫̙̝̹͓̤̙́ͣͤ̈́̋̽̋͜f̺̦̠̻̜̼̮͓̖́̓̄̿̓̌̓̍̔f̵̳̻̜̹̤̱̊͒ͤ͌ ̅ͭͮ̾͟i̗͖̎͗̇ͯ̈̀̌̽c̯̮̉ͮ̾͟͡i̵̺̻̠̘̤̫͕ͯͭ̅͊ͤͦͧa̷͇̖̲ͥ͗ͪ̎ͤ ̽̾ͫl̶̈́̉̉͂̿̎ͯͥ̐҉̗͙̦̻̪ ̪̻͕̗̝͈̘͓ͬ̋̕͟B͚̲̍͢ā̸̪͔͖̟ͫͨ͜͝s͈͔͔͖͇͍̗͛ͯ̑̂͟t̮̤̬̩̅ͧ̎͑͗ ̃̕͟a̸̧̻̖̘̞̪̲͈͕̲͊ͭͪ͆̉r̯̩̮̬̥̤̗̙̃͌̑͊͢͞ď̠̦̲̥͢͡ ̵̶̢̱̲̺͈̘̳͕ͤͅo̯̞̙̦͖̪̽ͩ͊ͅf̵̦͈̣͙̰̎͋̿́ͅ ̛͕̹̫̰̱̾̓ͪ̌̽̊͘͡W̨̬̲̤̖̽̿͛ͨ͛̃̎͐̏i̛̼̳̝̺̝̭͙͋̑͑ͬ͠ṙ̼͔̪ͯͨͭ ̕e̸̗͕̰̒̃ͩͬ̾͆́ͅͅ

    I Require More Minions! Join us on the IRC !
    List of Reasons to idle on the IRC: Wire QDB

  4. #4
    Wirererer Free Fall's Avatar
    Join Date
    Dec 2007
    Location
    Got digitalized and now lives in his PC's RAM
    Posts
    349

    Default Re: Learning Lua

    Well, if you bring some basic understanding for coding languages, you should be able to follow those steps:

    1) Take some script or entity, copy it, and modify it a little bit, to work a little bit different. This is done by commenting out lines, or changing values. While that, you learn a bit about basic syntax, and language itself.

    2) Try making something "on your own", but using parts from other entites. "Copy/Paste programming". By gathering parts together, you learn WHAT the parts do.

    3) start remembering parts of the parts, that seem important to you and learn most common commands

    4) sometimes write something totally on your own, only use other peoples code as reference. When you actually start writing something, you REALLY should try to keep a clean coding style (tabs on ifs and loops, etc). Otherwise you get confused over your own code.

    This should give you a way to enter the world of lua, or, lets say, the way I learned lua. ^_^
    Needz moar Lua

  5. #5
    Wire Sofaking tomb332's Avatar
    Join Date
    Mar 2007
    Location
    Birmigham,UK
    Posts
    1,377

    Default Re: Learning Lua

    The is the thing with gmod lua there is minimal documentation. I just learnt by looking at any code related to what i wanted to make and having a go.
    Eg When i was making the wired igniter i found out how to make it work by looking at the wired nailer and the igniter tool. Then mashing together appropriate bits of code.

    As to learning the lua language in general there is a huge set of documentation on The Programming Language Lua
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

    Super Easy Wire Download

  6. #6
    Success: An illusion turck3's Avatar
    Join Date
    Jun 2007
    Location
    USA
    Posts
    1,744
    Blog Entries
    4

    Default Re: Learning Lua

    Quote Originally Posted by ZeikJT View Post
    Honestly, the best way to learn something new is to try things, make mistakes, and then seek answers. Most often the error itself will be the answer you require to revise the original code.

    It can take some deciphering sometimes or a little common sense (I tend to over think the error).
    If you absolutely NEED tutorials there are some on the (horrible?) wiki:
    Lua Tutorial Series - GMod Wiki

    I started with an idea that I wanted to realize. So I browsed through the functions available to me and just began coding. Then got frustrated how client and server are separate, but moved forward.

    Of course, if you've ever coded in anything else before this should be a sinch to pick up, lua must be one of the most forgiving and simple languages ever.

    I would advise against learning from examples, they can be helpful sometimes but it is far too easy to simply copy paste then edit it to fit your needs.

    It depends on what you want to make as SWEPs and SENTs have different setups and the files go in different locations. Tell me which one you would like to start with and I'll set up a ready to script template for you to code in when I get back from school.

    That way you won't have to deal with setting it up (the boring and stupid part) and can just start experimenting with functions.
    Danke shen for a good answer, lets say I wanted to start with SWEPs first...

    Quote Originally Posted by Jat Goodwin View Post
    You really couldn't understand any of the resources that are on garrysmod.com?
    Basic Lua - GMod Wiki

    How I basically learned it is I read much of the documentation, then went and looked at lua scripts that had similar uses to what I was trying to make to see how they did it.

    Also for how many there are? I have to say the functions are damn well documented, except some of the more obscure functions.

    The egate 2 is essentially lua, but more dumbed down.

    Also man up a bit, stop your whining, and learn to google. Of all the languages ive played with, I'll say lua is about as easy as python.
    Oh I understood the tutorials on it, I understand some of the more basic functions, but it's in terms of making anything *useful*... as for your claim that I'm whining, it's called being realistic. The functions are terribly documented, and quite frankly, I was asking this to Black Phoenix the other day and he agreed. The language itself may be easier than python, but that was never what this was about, ever, this is about the gmod functions in lua and how they work.

    Quote Originally Posted by Free Fall View Post
    Well, if you bring some basic understanding for coding languages, you should be able to follow those steps:

    1) Take some script or entity, copy it, and modify it a little bit, to work a little bit different. This is done by commenting out lines, or changing values. While that, you learn a bit about basic syntax, and language itself.

    2) Try making something "on your own", but using parts from other entites. "Copy/Paste programming". By gathering parts together, you learn WHAT the parts do.

    3) start remembering parts of the parts, that seem important to you and learn most common commands

    4) sometimes write something totally on your own, only use other peoples code as reference. When you actually start writing something, you REALLY should try to keep a clean coding style (tabs on ifs and loops, etc). Otherwise you get confused over your own code.

    This should give you a way to enter the world of lua, or, lets say, the way I learned lua. ^_^
    Not really what I was looking for.... mostly self evident :P, thanks anyway

    Quote Originally Posted by tomb332 View Post
    The is the thing with gmod lua there is minimal documentation. I just learnt by looking at any code related to what i wanted to make and having a go.
    Eg When i was making the wired igniter i found out how to make it work by looking at the wired nailer and the igniter tool. Then mashing together appropriate bits of code.

    As to learning the lua language in general there is a huge set of documentation on The Programming Language Lua
    mmm, interesting, I'll try that I suppose. As for the link, been there, done that; it's not about the core language, it's about the gmod functions.

  7. #7
    Wire Sofaking Whodunnit's Avatar
    Join Date
    Jan 2008
    Location
    New Zealand, Ackl
    Posts
    636

    Default Re: Learning Lua

    I had the same issues when i tried this, I Could understand lua as i used it before for another game, however , for that game it was easy to read the documentation on functions and know what i was trying to do.

    Here there are few Things telling you what you need.

    e.g. say i wanted a to make a gun , what core functions do i need for it to work? how do i find where its aiming ? etc etc etc

  8. #8
    Wire Sofaking mjmr89's Avatar
    Join Date
    Mar 2008
    Posts
    555

    Default Re: Learning Lua

    <<<dumbass forgot there was more than one tutorial before posting.

  9. #9
    Wire Sofaking ZeikJT's Avatar
    Join Date
    Dec 2008
    Location
    California
    Posts
    1,391

    Default Re: Learning Lua

    I've attached my own template with comments here and there and the basic framework laid out.

    If you'd like two here's one someone else made (on that *horrible* wiki):
    SWEP framework - GMod Wiki
    It also has a download at the bottom of the page.

    It has something I don't, and I feel I have things it doesn't. So the two will complement each other. Please use them both, and just play and have fun! Coding doesn't have to be boring!
    Attached Files Attached Files
    Last edited by ZeikJT; 01-27-2009 at 11:35 PM.
    Against stupidity the Gods themselves contend in vain.
    -Friedrich Schiller

    The flame puts me in the mood to "Do it!".
    -Dart, Legend of Dragoon

  10. #10
    Wire Sofaking Whodunnit's Avatar
    Join Date
    Jan 2008
    Location
    New Zealand, Ackl
    Posts
    636

    Default Re: Learning Lua

    thanks! i have a working swep now.

+ Reply to Thread
Page 1 of 5 123 ... LastLast

Similar Threads

  1. GPU learning help
    By McLovin in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 0
    Last Post: 02-15-2009, 06:48 PM
  2. Learning CPU
    By Kupo in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 5
    Last Post: 09-28-2008, 11:17 AM
  3. Learning Cpu
    By limlik in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 6
    Last Post: 10-18-2007, 02:58 PM
  4. Learning
    By Luigi in forum Installation and Malfunctions Support
    Replies: 5
    Last Post: 08-18-2007, 11:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots