• What is the best Lua guide/tutorial (in your opinion)
    3 replies, posted
I've been reading various Lua guides and tutorials in hopes of educating myself a little on Lua, primarily for Garry's Mod, but also as a general interest, I don't seem to be picking it up fast and would like to say it isn't just down to laziness, so I was wondering, in your opinion, if you have one, [I]what is the best lua guide/tutorial out there?[/I]
Personally, doing it and trying to figure it out from scratch, looking at someone else's code or asking for help. The wiki (Both old and new) are Very helpful. The old wiki does have some tuts, but they are out of date and may have some things wrong with them. [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4875.html[/url] -old [url]http://wiki.garrysmod.com/[/url] -new
Don't look at somebody else's code, and don't try to copy anybody's code. That's no way to learn proper programming and will only serve to be a VERY slow way to learn how to actually code, it's harmful on the long run too, and despite it seeming to be a slow buildup, you'll be a master at Lua by the time you're done in far less time than you would have expected. First off, I would recommend learning some very basic level C++, there's a pretty good tutorial [url=http://cplusplus.com/doc/tutorial/]here[/url]. There's no need to really learn the more intricate parts of the language, but understanding the basic concepts of data types, arrays, control structures, data structures, strings, functions and classes will definitely help when you finally transition to Lua, it's also compiled. Feel free to code some sample programs in C++ first, you can find some tutorial problems from [url=http://www.spoj.com/]spoj[/url] which you can attempt to make a solution for (Doing programming problems takes time, and it is indeed difficult, but it's the best way of learning actual algorithms and coding practices, it also teaches you the importance of efficiency and what the best way to optimize something is) From there, all you have to do is transition your C++ knowledge into Lua, which you'll see is a FAR easier language with way less complications. If you learned C++ right, you should be able to transition most of your knowledge pretty quickly, as Lua forgoes many complicated matters like pointers, data types and type casting (Which is automatic and implicit in Lua), data structures are condensed into tables which can mimic any other data structure you know of (vectors, lists, maps, queues, stacks, classes) and share the similar property of existing as references only (Which adds some complications you need to be aware of like how you can't just copy a table by assigning). [url=http://www.lua.org/manual/5.1/]Here's a link to the Lua manual[/url], which uses some [I]kind[/I] of technical terms but should be fine for solving doubts, and here's a repository of [url=http://lua-users.org/wiki/TutorialDirectory]Lua tutorials[/url] From then on all you have to do is read some code to kinda get the gist of how things work in Garry's Mod, using the wiki to support your knowledge of the Garry's Mod libraries, and bam, you are now able to code pretty much anything you wanted in GMod.
Thanks! I'll definitely try these out, so far I've just been editing other peoples code, not doing so well, it seems to me that every bodies code is different (even if it might be the same function/addon), so thanks for the tips Big Bang, I might have a look into C++ now.
Sorry, you need to Log In to post a reply to this thread.