• How did you learn Lua?
    43 replies, posted
So, I've been coding in Lua for a while now, covered all the tutorials on the GMod wiki and it feels like the only way I can increase my knowledge is by reading the entirety of PiL... but that's just not fun. [IMG]http://cloudsixteen.com/forums/Smileys/default/undecided.gif[/IMG] So my question is to those of you who see yourself as knowing a lot about Lua or just to those who have a nice portfolio of Lua or game design in general, or even those of you who are modest and would just like to give some advice; How did you learn Lua? and what would you recommend people do, read, watch or investigate to learn more? P.S I avoided posting this in the questions section as I'm not necessarily asking for help with Lua, I'm just trying to get a discussion going.
Well, the thing that got me to coding was some perfect dark weapons pack addon on garrysmod.org. Was so proud changing the fire sound name in the shared.lua file to some other guns fire sound. That was my first ever experience with Lua or coding/programming in general. After that, not even realizing that there are tutorials or even a forum called facepunch tried to combine various pieces of code from elses work, finding out how everything ticks. Until I've gained enough knowledge so that looking at other people's work for code became inconvenient and just started trying to write my own code instead. For beginners I'd recommend going through the tutorials first then checking some tiny addons, like weapon packs or some entities to learn what does what.
Just wanted to make something.
Begging, reading, and trying.
Learned how the syntax and the language itself worked thanks to PIL, then I started reading others's code and used the GMod wiki as reference to write my own stuff.
Mostly reading.
[QUOTE=Loures;36067007]Learned how the syntax and the language itself worked thanks to PIL, then I started reading others's code and used the GMod wiki as reference to write my own stuff.[/QUOTE] This. It's probably the fastest way to learn. What noobs fail to realize is until you understand how the language works on the inside, you will fail to learn how to write your own code without looking at others works. Programming requires a unique way of thinking to efficiently get your work done.
Download luapad from garrysmod.org, and like this, you will learn WAY more than you expect: [lua]for k, v in pairs(ents.GetAll()) do -- This scans every entity if v:IsNPC() then -- If its an NPC then v:SetColor(math.random(255), math.random(255), math.random(255), 255) -- Give it a random color v:SetMaterial("models/shiny") -- Make it a solid color elseif v:GetClass() == "prop_physics" then -- If its not an NPC, and IS a prop then v:Ignite(25) -- Light it on fire local random = math.random(500) -- Generate a random number v:GetPhysicsObject():SetVelocity(Vector(0,0,500+random)) -- Shoot it up into the air end -- Finish the sorting end -- Finish the scan[/lua] Find more things to "v" which is the entity found, here: [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexd46d.html?title=Entity[/url]
I wanted to piss some kid off. Wrote a script to spam a Derma menu going to MeatSpin 2Girls1Cup etc. No Close Buttons... (math.Random() ) For Da Win!
In high school I learned Ada. Soon after finished Programming A and Programming B I discovered Garrys Mod. Found it fascinating that you could make your own weapons so I couldn't resist to have a look at it since I've only used the command prompt when programming Ada. So I just started by reading other peoples code and getting used to the syntax. Also started by checking some beginner tutorials and after that I just kept going. You should find it fun to do scripting or programming on your free-time (as a hobby). If you find it fun then learning and improving won't be a problem. If this isn't obvious then maybe programming or scripting isn't for you. Believe it or not but there is quite a big difference between programmers who have just learned programming and people who actually find it fun.
Wanted to make TPC (Tactical Police something or other) in Garry's Mod 9 give cash for killing NPCs. Set out reading the wiki and fucking with shit until I got it working.
DarkRP editing :downs:
i started of by simply taking someone elses weapon and made it shoot faster. then it kinda picked up from there.
about same as the guy above but i dont really know i just hope for the best
I became really good at expression 2, then realized I should try Lua. After reading everything all tutorials and the documentation part on the Wiki I sorta said "now what" so I made a poor gamemode. Ever since I do small things for friends. I love it too, I always do the stuff for free (it's fun, not a job).
After learning E1, I wanted to try to learn a programming language but wasn't sure which. Then E2 came out which was the perfect excuse. After that, I found out that gmod uses lua and read up on pil and the glua wiki.
Back around 2005 or 2006, I took a VB class and learned the basics of programming, and applied that to Lua. I spent that summer more or less teaching myself after looking at a few example scripts on the old wiki and some sweps, and reading theJ89's tutorial a couple of times. I really learned to love short load times over the years.
Slowly dissecting scripts and Frankensteining my own together. It works...eventually.
Lua PIL, pretty much the holy bible imo.
I started out modding TTT SWEPs, and slowly moved on to more complex things, now i'm making my own gamemode. Lua wiki helped quite a bit with learning gmod functions etc, although some of the tutorials are pretty crap to be honest and I probably learnt more about the syntax of the language from looking at other's code and making my own.
tired to waiting for new stuffs. so I decided to make some new stuffs.
I've always done minor programming. C++, Python, PHP and some other crappy things, GML and AutoIt. I asked to help on StargateRP. Didn't go to well, But I made a decent looking HUD and some half-working mineral spawning script. Then I didn't do more. Recently though after 2-3 years, having done programming in school and stuff I've been looking back into lua because I have a lot of free time. At least I'm learning quicker now than then.
For my the easiest way to learn is to just code things, the more you use lua the easier it will become for you to use. Just try to code everything that comes to mind, and whne you get stuck refer to the old wiki or this forum
Started off tweaking basic entities/weapons, then started tweaking gamemodes, then tried to write zombies gamemode, which ended up failing horribly, edited DarkRP, then started addons and gamemodes that never really got finished, but got more and more complex as I went. I have yet to read more than a few pages of PIL.
Long time ago I started to learn e2, then a few months ago I wanted to try out lua so I read the tutorials on the wiki and started making small scripts with luapad. It is acutally a lot easier than I thought.
When I was a small child I played roblox. That was my first introduction to coding of any kind. Roblox will always hold a place in my heart despite it's current shittyness. I expermented with various programming languages, played a shitload of videogames, ended up in gmod, relearned lua by working on a gamemode.
Since I'm still a bit of a noob, i guess my story won't matter much. Started with making my own TTT sweps, then taking friend's ideas to make other sweps. AFAIK it's pretty much following a template and adding stuff, but it helps if you know some basic coding (like how to make an algorithm, basic if commands and stuff like that). Now I'm learning some advanced stuff and I'm hoping to make a game mode in the future. Hope this helped
Darkrp Editing And a few tut's
looked at the popular names in gmod a few years ago and asked questions, bugged the shit out of them and i learned eventually, never really read the pil or anything but i used the gmod wiki a ton and yeah. i learned it because i thought it was fun and i enjoyed it, so it was easy. ish
I once tried making an elevator map (long before elevator: source, but hey that happened too) and had to have some things fixed for it to work (the elevator was sideways, I wasn't a very good mapper and still am not). From that I continued making small entities, many increasingly more complicated than the last. Although I have a horrible horrible habit of getting something [i]mostly[/i] finished, but not releasing it, being afraid of a massive influx of bugs I wouldn't know how to fix in a timely manner.
Sorry, you need to Log In to post a reply to this thread.