1: How to use this thread.
[release]a) You should read through all of it. The contents at the top are pretty straight forward. If you are new to lua and want a place to start out, head over to section 2; References and common/important websites.
Section 3; Making a thread, is to help you create a thread that contains the relevant content and presentation you should show if you wish to get help, fast cleanly and efficiently.
b) This thread is not a rules thread. It is here to guide you, and help you. I tried not to make it a huge thread, just small paragraphs to read through. This is not a guide to lua, it’s not a tutorial on how to learn lua, it is basically references to different websites and recommended information to read.
2: References and common/important websites.
[release]a) Lua Pil; This website here is the main starting point for all of us. It is basically the bible you should read and re-read. It will teach you step by step how to create things using the lua language. On a personal suggestion, read through it, and once you have reached and finished Part1, Section 6, try make some thing basic using the GMod lua syntax and functions. You will if properly understood the pil, be able to easily write functions with your own parameters, create simple loops like the ‘generic for’ basic knowledge of ‘if then else’ and many other basic techniques you will use. But don’t be afraid to keep going back to the pil every 5 minutes to check if you’re using a function properly, or not sure how some thing works within lua.
b) Gmod Lua Wiki; This is the 2nd most important link. This is the wiki that contains all the functions/hooks/libraries needed to create more impressive things within the game Garrys Mod. Not only does it contain all the functions, but also a tutorial series to give you an even bigger kick start into the world of GMod lua. If you are looking for a function to do some thing. There is a high chance it is in the wiki.
Here’s some of the most common pages you will look at.
c) Code Browser;
If you can not find the function you are looking for in the GMod wiki, or the Wiki does not contain information about the function you are looking for. Lets say there is no documentation posted about that function. A last resort is to search for it in the GMod code browser. You should search the function using the search bar at the top. There is a high chance there will be a snippet of code where you can see how the function you wish to use is called. This, although might be slightly harder to understand what’s going on, but after all what is there can help you.
d) Programs/applications recommended.
Now you’ve got into lua, you’ve started out doing a few things. It’s time to start using a program to help you create lua files and reduce common silly errors.
The most common used program spoken by the community is Notepad++. Then there are plugins made by the community to help you even more.
Such popular ones are:
The GMod lua syntax highlighter. This plugin highlights GMod related functions. It makes the look of your code easier to read, understand, and can reduce common silly spelling mistakes.
The GMod Lua auto complete plugin. This one is brings up a menu of all the functions for a faster/more productive working environment when coding. Can be helpful too if partially forgotten the name of a function.
3: Making a constructive thread.
[release]a) You want the right audience for you to get your problem sorted, but you don’t want to clutter up a forum and risk the thread being locked before it was even viewed by some one. You should think about what you are asking for, and post the thread in the correct section.
So you’ve been coding away, and you’ve hit a problem you can’t seem to get around. What do you do? You come here of course! But wait! You can’t just post minute information expecting a huge fix to be done for you in 5 minutes time. Present yourself and show that you want to know how to do some thing/get some thing fixed.
Lets get some things straight though, you want the right audience for you to get your problem sorted, but you don’t want to clutter up a forum and risk the thread being locked before it was even viewed by some one.
[release]A: If you thread is more of a “I would like abc, that can do xyz” put it in the Requests section.
B: If you’re asking a question, put it in the Newbie Questions, Even if your post does not seem at all very newbie, a lot of us browse the newbie question section for a time killer and it gives our hearts little flips inside when we help some one.
All you need is some basic formatting and information to get help. But lets say the old saying, “help us help you”. We need information about your problem, you can’t just say you get x:24:y tried to call z, a nil value with no code for us to look at, not letting us know what’s going on.
Make sure you give a well put, good, short, relevant title name for your thread. It’s already in the rules, threads with titles like “HELP ME DO XYZ” are not worthy. Give it a title of your problem, like “Ent:SetColour() resulting nil method.” But don’t put the whole problem in there, that’s what the actually thread message is for.
An example of bad posts:
[release]**(1:)**This person thought we could read the code he had on his screen with our magical minds.
**(2:)**and again, we can’t read your code if you don’t post it.
**(3:)**This guy thought that he would get what he wanted with barely no information given, and terrible spelling ability. Not to mention presentation is not worthy of speaking of, it’s pretty obvious.
The problem is with these kind of posts (:iiaca:) is that it’s like saying the left passenger door of your car doesn’t open, but giving us a picture of the petrol cap on the other side of the car, all we can do is throw at you “Are you doing xyz? abc only works in xy but z works in bc” and we could throw at you hundreds of different variations of that very quote, when the problem might have just been you didn’t unlock that side of the car. This is a reason why you will not get help, some of us don’t have time to ask you to give us more information if you don’t seem willing enough for help in the first place.
Here’s a quick example of a reasonably good posted problem:
He’s given us all the information we need. And all some one has to say to him is:
Take a note that I actually commented the line 5 to state “this is line 73”. Other wise it’s more for us to read and understand what’s going on. If you post a more complex problem with more code we might not want to look through for a problem where you could have given us a pointer. Remember, we don’t get paid to help you, it’s not our job.
See how quick and easy that was? Instead of us asking for more information about how you are doing it and then asking for your code. That example I admit was very bland, but it is an easy common mistake that I always personally did when I started out.
b) Here’s a template you can use for making your post:
Just copy and paste it into the thread message text box and fill in/replace the notes I put in there. It is already tagged out with boldness and the lua tags for your code.
For no reason, what so ever unless you absolutely HAVE to, must you edit your thread to say “fix’d”. It is very selfish and inconsiderate to do under any circumstances. Other people might have the same problem, and want to know a fix in the future, when they find your thread, then find out that you edited it all out removing it all and not telling us how you fixed it, you’ve wasted our time.
4: Community notes/Requested information.
[release]More information will be added here upon request.