Someone can help with classes?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
LinaInverse
Prole
Posts: 5
Joined: Tue Feb 03, 2009 3:54 am
Location: SteamID: SuperOwca

Someone can help with classes?

Post by LinaInverse »

Hello everone, I'm new here. I have some problems, but the worst is:
I dont know how to use class! You can see in my signature "I'm Programmer", but I'm know only basics of C++(Maybe little more then basics^^), Visual Basic, C# and LUA, but thhis classes just make me so angry... Anyway, Someone can explain for me how to use classes? (I just drank too much coffee today, so I can't say this easier)
I'm Girl, I'm Blonde, I'm Programmer, MayBe Even Gamer (Who Like To Play Left4Dead?)
User avatar
zapwow
Prole
Posts: 48
Joined: Fri Oct 24, 2008 11:37 pm

Re: Someone can help with classes?

Post by zapwow »

Hi LinaInverse, welcome
The crazy thing about lua is that it doesn't have classes. However, it does have tables, which are sort of like arrays. These tables are not limited to data types, and can contain anything you want, including functions. By stuffing tables with functions, it's possible to make one act like a class.

This article has a very good implementation and explanation.

BTW - everything in lua is passed by reference, so it's like these tables contain pointers to their contents. Good to know.
User avatar
LinaInverse
Prole
Posts: 5
Joined: Tue Feb 03, 2009 3:54 am
Location: SteamID: SuperOwca

Re: Someone can help with classes?

Post by LinaInverse »

Oh, Big Thanks
I'm Girl, I'm Blonde, I'm Programmer, MayBe Even Gamer (Who Like To Play Left4Dead?)
User avatar
mike
Administrator
Posts: 364
Joined: Mon Feb 04, 2008 5:24 pm

Re: Someone can help with classes?

Post by mike »

LinaInverse... you claim to be a girl. Because of the fact that I am a male geek and you have ventured into our hunting grounds, I am obligated by the Board of Male Geekyness, led by the honorable XXXJudgeDoomHammerXXX and overseen by JamesTPicard86, to ask you the following question:

a/s/l ?
Now posting IN STEREO (where available)
User avatar
Skofo
Party member
Posts: 146
Joined: Mon Dec 22, 2008 10:55 pm

Re: Someone can help with classes?

Post by Skofo »

Obligatory.
Image

But on a serious note, I say just forget about it. You really don't find people who feel the need to broadcast to everyone their lack of a Y chromosome in their signature annoying?
Working on: Viator
Need a 64-bit Debian package for LÖVE? Here it is!
User avatar
Merkoth
Party member
Posts: 186
Joined: Mon Feb 04, 2008 11:43 pm
Location: Buenos Aires, Argentina

Re: Someone can help with classes?

Post by Merkoth »

MY.FUCKING.EYES
NEED.SPOON.REMOVE.THEM
AGH.
User avatar
qubodup
Inner party member
Posts: 775
Joined: Sat Jun 21, 2008 9:21 pm
Location: Berlin, Germany
Contact:

Re: Someone can help with classes?

Post by qubodup »

oh $dog you idiot, you walked right into it. dude. how many years have you been on the internet? :?
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
User avatar
mike
Administrator
Posts: 364
Joined: Mon Feb 04, 2008 5:24 pm

Re: Someone can help with classes?

Post by mike »

I löve this forum. ^^
Now posting IN STEREO (where available)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 52 guests