confused somewhat

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: confused somewhat

Post by murks »

Thanks Robin.
Most cases where I have seen them used were OOP implementations, and that stuff looks complicated.
I found this book and although it contains some mistakes it is helpful because it shows some somewhat simpler examples for a change. https://en.wikibooks.org/wiki/Lua_Programming/Tables

I guess I'll read the PiL explanation again and have another look at the OOP implementations again.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: confused somewhat

Post by Robin »

murks wrote:I found this book and although it contains some mistakes it is helpful because it shows some somewhat simpler examples for a change. https://en.wikibooks.org/wiki/Lua_Programming/Tables
Which mistakes are those? I skimmed the page but didn't see any glaring errors.
Help us help you: attach a .love.
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: confused somewhat

Post by murks »

They're not glaring errors, but sometime stuff is hard to understand what the author meant, for example:

Code: Select all

mode
    This metamethod should be a string that can contain the letter "k" or "v" (or both).
How can a method be a string? What is this supposed to mean? A method that returns a string? The name of a method as string? Can the string consist of anything other than "k", "v", "kv" ("vk"?)?

There are some similar weird formulations in other parts of the book, but nothing too bad.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: confused somewhat

Post by bartbes »

I'm guessing calling it a "metamethod" may confuse matters, but you're just supposed to assign a string to it, that can indeed be "k", "v" or "kv", and probably "vk", too. It can't contain other letters, from the looks of it, but the actual results are unspecified.

It's always kind of interesting how the lack of information is information too, in these cases.
Ramcat
Prole
Posts: 18
Joined: Sun Jun 01, 2014 12:12 am

Re: confused somewhat

Post by Ramcat »

Robin wrote:...something has to "click" in your head...
Oh, how I would like to be able to explain this to common folk. For most people, I think, this "clicking" is a rare thing, less than once every 6 months. Said another way, more than 6 months passes between clicks. For me as a software engineer this can be an every day thing when I am working hard or learning a new language.

As for "Stage Manager" and "LoveTank", I had a "click" as to how objects should be done in Lua and have re-written LoveTank from the ground up. Soon, I'll release another version of both.

What has not clicked for me yet, is: What does "closure" mean? The end of a function?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: confused somewhat

Post by Robin »

Ramcat wrote:What has not clicked for me yet, is: What does "closure" mean? The end of a function?
It's late and I'm tired, so no informative post from me right now, but if you want I could write you up something about closures tomorrow.
Help us help you: attach a .love.
User avatar
jasper.davis
Prole
Posts: 24
Joined: Fri Oct 25, 2013 2:32 pm

Re: confused somewhat

Post by jasper.davis »

Ramcat wrote: As for "Stage Manager" and "LoveTank", I had a "click" as to how objects should be done in Lua and have re-written LoveTank from the ground up. Soon, I'll release another version of both.
I look forward to seeing that. would documentation through comments in the code be possible?
Ramcat
Prole
Posts: 18
Joined: Sun Jun 01, 2014 12:12 am

Re: confused somewhat

Post by Ramcat »

Robin wrote:but if you want I could write you up something about closures tomorrow.
That would be lovely.
jasper.davis wrote:...would documentation through comments in the code be possible?
:x Thou doest stab at my heart. :cool: Usually my commenting is better. LoveTank is a bit light on comments, partially because Lua has no /// (triple slash) or /** (Java style) commenting mechanism for functions. I'll remember that as I edit the last class I have left to finish and take a quick look over the others to see if I can bring it up to par with my professional stuff.
Post Reply

Who is online

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