How did YOU learn GLua?

Trying to get into GLua, so I ask: How did YOU start learning GLua?

I was introduced to Meta Construct, a sandbox server with a lot of developers, which a lot you’ll recognize from Facepunch possibly. I decided to learn GLua from anyone that would offer help and on my own with the wiki, GLua Docs and making threads about what I needed help on or using PTDNTOT for posting.

i looked at the sent ball example, found the wiki, then the proper wiki

examples are great :excited:

Picking apart the PropHunt gamemode, having a few guys who knew Lua and were nice enough to start mentoring me, showing me things, and I’d write code and then have them take a look and they would show me ways of doing it better. Plus countless hours in the Garry’s Mod wiki.

Doing things on your own and only asking for help when you need it, not asking someone to write the entire script for you. You learn the most by making mistakes and figuring out ways to correct them.

Thanks for the Replies guys!! Will definitely take you guys’ help into consideration!

I made small scripts for DarkRP on coderhire from the jobs section. Most jobs arent hard and actually gave me an understanding of how to do everything.

I started taking apart free addons, changing veriables, and numbers to see their effects. Sometimes I would Frankenstein-code parts from different things together to create my own things.

The original code from my throwable crowbar came from that Old IronMan SWEP (the part that punches), the chair gun from the wiki, and the thrown entity came from the ball sent that came with GMod.

Computercraft mainly. I try to stay away from the garry additions to lua as the syntax doesn’t bother me much

I looked through a SWEP pack’s coding and looked through the variables it used, so I then decided to make my own SWEPs off of what it used. But, I never learned about functions until they were explained to me by a guy I met who had coded a gamemode. I then found the wiki, found facepunch, created threads and asked questions, joined a dev project where I added bots to a gamemode, looked up functions, looked through addons, and what not. The first gamemode I created can still be found here(beware: it’s EXTREMELY shitty :V)

I learned about metatables and other internal things about Lua itself instead much later, as I only started off with simple functions and variables used to create very simple gamemodes and SWEPs.

Wiki and released scripts.

I was mastering E2 from wiremod … but found it annoying being limited.
I started by launching my own server and read other peoples scripts, to ‘reverse-learning’ them. (Basic I messed around in the .lua files to see what kept the gears turning)

The first script I made was a command called !Yoda. It allows admins to say something anonymously, but twists their words so it fits the yoda-character.

!yoda How are you all?
Yoda: You all, how are Hmmmm...?

!yoda What is not working?
Yoda: Working, what is not ... yes...?

Shortly followed by !yodakick <person> <reason>

I would say that the best way to learn Glua, would be reading other peoples scripts and start with something easy. Like a command or HUD.

I wanted to create the coolest coderhired up darkrp server like everyone else. Then I decided to recede all the corehire stuff, then the adminmod, then the gamemode. Like Nak said learning by example works great.

One of the best things for me was also running a local server to script stuff on. So actually running a srcds server versus through gmod.

Aide, what would you suggest I script? I know NutScript Completely ( A Gamemode Base ) , but that’s pretty much it… What would you suggest I make to get good practice for a beginner?

If you actually did you’d know enough code tons of things. Start with something that interests you and see where it takes you.

No no no. I know like basic scripting. Factions, Items, Classes etc. Mostly just looked up video examples on how to do it. That isn’t the same as knowing Custom LUA. Scripting in NutScript is much different than making custom Content, as it is a Base.

I also completely agree with this. I use to try things out in a simple garry’s mod single-player instance, but nothing beats actually setting up your own srcds test server locally just as you would a live server.

As far as where to go from here - as recommended by others. Take apart a few scripts and see how they’re coded. You’ll start getting ideas in your head about how you’ll want something to look/work, and then you’ll start finding solutions on how to accomplish these tasks. Your best bet is to always have the Garry’s Mod Wiki open when you’re learning, and also, do Facepunch searches for coding solutions. Chances are if you run into a common error or issue, someone has posted the question on these forums and there’s probably a solution - so search on here if the wiki doesn’t explain it.

Bigger rule of thumb is that if you have an issue with your code, and you want to post it on these forums to try and get help; always provide the code you have to show others. Don’t expect people to code your entire script. We’ll tell you where you went wrong and what direction to go in, but don’t expect someone to hold your hand and do the work for you; it’s not because we’re assholes - it’s because you’ll learn nothing that way.

NutScript and all of the administration mods.
Mostly NutScript, because it’s very efficient and well-optimized.

i learned Glua by modifying and creating TTT weapons for my server about a year ago

I screwed around with vgui stuff and eventually made a panel in which admins can kill whoever they want/do whatever to a group or a single player

Also from asking dumb questions all the time on facepunch