How do you Lua anyway! Tutorials do not help...

Many tutorials teach you based on the fact that you already have prior knowledge with Lua. This is not the case, I am totally new to this coding, if someone could tell me how, in exact detail and exact order, so I may learn, and not just copy, thank you.

Go into your addons folder. Find something with some lua files in it. Be able to understand how certain things fit together, at least primitively, and read. Also check out the wiki for shitloads of articles about Garry’s Mod specific lua stuff. Honestly man I just learnt by reading dozens and dozens of already made lua files, and scanning the wiki for interesting shit.

Good luck.

Have a look at these:
Programming in Lua
Garry’s Mod Wiki
LuaBin (Lua source files)

As stated before looking at other peoples scripts is very helpful most of the time.

Just think of an idea, then download a bunch of peoples lua which does similar things, and try to mash them together into your idea (don’t release though, since it’s mostly not your code!)

It’ll teach you the basics of syntax etc very quickly.

My order of lua’ing:

  1. Creating the folder for the addon/gamemode
  2. Creating hte info.txt file
  3. Creating/copying the shared.lua, cl_init.lua and init.lua to the “gamemode” or “addon folder”.
  4. (Gamemodes) I begin coding the engine (init.lua and shared.lua). Then the HUD (cl_init).
  5. TEST!
  6. WIN! (Final fantasy Victory theme)

If you want to script a gamemode, begin with easy things like the “PlayerLoadout” function, wich gives players the weapons they need on spawn. Or the “PlayerInitialSpawn” function, wich starts when a player joins for the first time.

You can find TONS of other functions at:

Just search for… lets say… “ents.Create” or… “Create entity”, and KAMAFUCKINGBOOOOM, its there!

i would also recomend learning to understand the error messages:

If you can’t follow these simple tutorials you might as well just shtop.

There is no exact order because everyone learns in a different way. If you don’t understand whats in the tutorial then find another or better yet buy yourself a beginners book. I took classes in C++ programming basics about 4 years ago. Once the classes were finished I lost interest and stopped coding but when I came across Lua in Garry’s mod I automatically understood what was going on because it looks and functions like C++ so I guess those classes weren’t a waste of money and time. :smiley:

You also have to remember that nobody learns how to be a decent coder over night. Put the some time, reading, and practicing into your interest in Lua and it will pay off. The learning never stops when it comes to subjects like this.

Yeah. Nick365 is right. It’s like learning an instrument(Piano for example.) You start off and you can’t really play anything. You practice for a couple of months and you can play Fur Elise horribly, but you can make it. Then you get pissed because you see someone else do it better than you. Then you have two options: Quit or practice harder. This is key right here(PAY ATTENTION!). This is what separates the coders from the skiddies…The coders don’t give up when the going gets tough. The skiddies give up and plagiarize material that isn’t theirs, but they take it anyways to make themselves feel better. If you wan’t to learn Lua, you better be dedicated.