Constructive thread

From GMod Wiki

Jump to: navigation, search
Lua: Constructive Thread
Page white text.png Description:How to make a constructive thread on the forums
link=User:Jamie Sharpe Original Author:Jamie Sharpe
Calendar.png Created:September 07, 2009

How to make a constructive thread on the forums

Contents


How to use this page.

Read it

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.

What it's not

This page is not a list of rules. It is here to guide you, and help you. I tried not to make it bloated, 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 and follow when making a thread on the forums.


References and common/important websites.

Lua Pil

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.


GMod Lua Wiki

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.

Server function list

Client function list

Global function list

The search feature You should always search from here before posting or asking questions

GMod Code Browser

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.

Recommended Tools

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.


Making a constructive thread on the forums.

Right Audience

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. Follow these simple 2 rules.

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, even if you don't consider your self or your question newbie, put it in the Newbie Questions, 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.

Examples of bad posts

(1:)

This person thought we could read the code he had on his screen with our magical minds.

includes/modules/http.lua:28: bad argument #1 to 'Download' (string expected, got table)

:/ help :/

(2:)

and again, we can't read your code if you don't post it.

How do I fix this problem? I'm just trying to declare a font in my cl_init.lua and it keeps throwing me this error:
--\gamemode\cl_init.lua:10: attempt to index global 'surface' (a nil value)

(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.

Hey hai hi wassap I need uh, a physical property (y'know, like rubber) with really high grip so for I can climb thingeez with tank treads and junk. There's some kinda way just tell me ok hurr bai

The problem is with these kind of posts 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.

Example of good posted problem

'''What I expect to happen:''' I'm trying to make the colour of everyone in the server blue when I call a console command.
'''What actually happens:''' errors out '':73: attempt to call method 'SetColour' (a nil value)''
'''Code:''' <lua>function makeAllblue()

	for k,v in pairs( player.GetAll() ) do
	
		v:SetColour( 0, 0, 255, 255 ) --This is line 73
	end
end
concommand.Add("blueplayers", makeAllBlue)
</lua>

'''Notes:''' It looks fine, the error only shows when I run the command "blueplayers".

He's given us all the information we need. And all some one has to say to him is:

Hey, you're trying to use "'''SetColour'''" when really it should be "'''SetColor'''". [http://wiki.garrysmod.com/?title=Entity.SetColor Here's the wiki link] that you might want to read.


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, we was able to answer it in one post cleanly.


Template

Here's a template you can use for making your post:
[b]What I expect to happen: [/b]''What do you want to do?''
[b]What actually happens: [/b]''What errors/problems are you getting''
[b]Code: [/b] [lua]''paste relevant code here''[/lua]

[b]Notes: [/b]''extra notes you think might help us more. be as descriptive as possible.''

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.

No reason to;

For no reason, what so ever, 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.

And always, ALWAYS, ALWAYS mention how you fixed it in the thread

Community notes/Requested information.

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox