Noob looking for help!

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Noob looking for help!

Post by Lafolie »

TheKraigose wrote:A tip - comment often - specifically at the top of each function or each lua file. This will help you remember what function does what in detail. It may seem weird but trust me, it's good practice.
This is something that you should get used to doing right from the start. This little piece of advice can be found a million times over if you search for programming tips. It's one of those things that makes such a huge impact yet requires so little effort but many people still don't do it.

Even if you're just writing a relatively arbitrary function that is small and simple, commenting it's purpose, arguments and methodology can be incredibly useful. It helps not only with debugging but just understand your older code (which is easy to forget!), especially when you remember that you coded something before and want to go back and re-use it or whatever.

For me, commenting code helps me understand what the hell is going on when I get an unexpected error or odd behaviour. Reading what a few lines is supposed to do rather than studying syntax first makes more sense to me and helps me identify my mistakes and understand what is actually going on much more easily.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 2 guests