Code walkthroughs

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Code walkthroughs

Post by Santos »

Learning from other people's code is neat!

I think it would be cool to make code easier and less intimidating to read and understand by writing some "code walkthroughs", which walk the reader through some nifty code, exploring how problems were solved, explaining how the code works, giving the necessary information to understand it, et cetera!
codewalkthroughs.zip
(309.01 KiB) Downloaded 73 times
The HTML (except for Proxy) was generated by Locco.

^^
Last edited by Santos on Thu Oct 20, 2016 4:51 pm, edited 4 times in total.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Code walkthroughs

Post by Roland_Yonaba »

Holy - .
That's an impressive work...
Stickied, I'll read it after, then i'll provide some feedback.
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Code walkthroughs

Post by josefnpat »

This is awesome.

I also like the changes you made.

Feel free to make a pull request. I'll accept it right away.
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Code walkthroughs

Post by Roland_Yonaba »

Just read the whole thing.
And I must say, well done, Santos!
Actually, Josef's code was very clean (hence easy to figure out!).
I didn't know about that tool. That's a brilliant idea, by the way.
I may have missed it in the Projects And Demos section. :ultrahappy:

@Santos: Maybe you will write next some other code walktroughs (would be amazing!). So, why not edit the your OP, insert a bulletlist of all of them and keep it updated ?
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Code walkthroughs

Post by josefnpat »

Roland_Yonaba wrote:Just read the whole thing.
And I must say, well done, Santos!
Actually, Josef's code was very clean (hence easy to figure out!).
I didn't know about that tool. That's a brilliant idea, by the way.
I may have missed it in the Projects And Demos section. :ultrahappy:

@Santos: Maybe you will write next some other code walktroughs (would be amazing!). So, why not edit the your OP, insert a bulletlist of all of them and keep it updated ?
I'm glad people like it. The code imo was never clean or stable enough to really justify a thread, so I never opened one.
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: Code walkthroughs

Post by Santos »

I'm happy you two like it! :awesome:

inifile.lua by bartbes has been added!
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Code walkthroughs

Post by Roland_Yonaba »

That's brilliant! :awesome:
Some glitches, by the way. On the right side of the page, there's a weird statement to delete... just before function inifile.save(name, t).
love.graphics.rectangle(mode, x, y, width, height)


And after that, there is a little mistake with a patten matching string.
String methods can be used on literal strings if the strings are within parentheses.
In this case, ("[s]\n"):format(section) is equivalent to string.format("[s]\m", section).
Must be replaced by:
String methods can be used on literal strings if the strings are within parentheses.
In this case, ("[%s]\n"):format(section) is equivalent to string.format("[%s]\n", section).
Once again, good job!
That could be very interesting lecures for those starting both Lua/Löve, cause there are so many things to learn from this.
User avatar
Larsii30
Party member
Posts: 267
Joined: Sun Sep 11, 2011 9:36 am
Location: Germany

Re: Code walkthroughs

Post by Larsii30 »

wow this is amazing.
Really helpful and a good way to explain people like me how things work. :D
Good job!
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: Code walkthroughs

Post by Santos »

Thanks so much Roland, both places have been fixed. :)

And thanks Larsii30, I'm glad that you like it, feel free to let me know if anything doesn't make sense or could have been explained better, or any other suggestions or critiques you have!
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Code walkthroughs

Post by bartbes »

That was awesome! And while I'm at it, I might as well thank you for using inifile.lua for such a great tutorial, so thanks!

One minor detail though, your requires are wrong, you forgot to remove the extension ;).
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests