So you know Lua, but where do you learn all the functions?

Well, I’ve spent a few days on the GMod Wiki, and I completely understand Lua. My question is, how do all of you scripters know the thousands of functions of Garry’s Mod (like SWEP:PrimaryAttack(), and all the other things in code) and how to use them in code? Where can I learn these? Really, Lua has no point if you don’t know where to find the ingredients for the code recipe (yeah horrible anology.)

etc… You still basically have to know what you need.

A lot of functions have titles that make sense, but you always have to check it on the Wiki. Others you’ll just have to search the Wiki for. The Wiki has documentation on most of the functions available for Gmod Lua. Eventually, you’ll learn commonly used functions by heart and won’t have to look them up, but for a while you’re going to have to use the Wiki.

I used to spend my days browsing the GMod Lua libraries alphabetically and memorized what each function did.

maybe?

Also, Overv made this really cool site here

You can use it to search for functions that do what you want. It’s a lot better than the wiki search.

Essentially that. If you think you need something - it probably exists - do a search for it. The serverside lua funciton dump (page was linked somewhere on this page) is a great place to run a find for things. You also cited the example of a SWEP hook - well, we’ve got pages for those sorts of things too. The only new piece of information I think I can contribute is a recommendation to dissect some existing code relevant to what you’re trying to make - it’ll give you some new ideas and show you some functions you’re likely to employ.

I wouldn’t be anywhere near where I am now with coding ability if either the Wiki wasn’t there or we couldn’t look at other people’s source code too see how they did something. I always have my GMod windowed so I can look at the wiki and change my code while I’m in the game, then go back into it and do lua_reloadents. Must be the easiest game to script I’ve ever tried it for.

Yeah I like using that first since it finds the more obvious things that the wiki can’t, but unfortunately the wiki also finds some things that overv’s can’t.

When I have time, I’ll make it search every single page. For now, it’s just an addition to the wiki search.

The two best ways to learn the functions in Gmod is to look at working source code and see how it is logically used. If you find a function you don’t know, you alt-tab to the wiki and search it. After you feel confident enough with your knowledge of the functions of gmod, you may start developing your own source code, which others will read and learn from.

[sp] The circle of- nvm :V [/sp]