A good OO lib

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.
User avatar
rokit boy
Party member
Posts: 198
Joined: Wed Jan 18, 2012 7:40 pm

Re: A good OO lib

Post by rokit boy »

Robin wrote:
rokit boy wrote:What is __len__?
The # operator. It is not overridable for tables in Lua 5.1 (though it will be for Lua 5.2).
rokit boy wrote:Btw. I smell python. Is it python inspired?
Yes.
Do you mean:

Code: Select all

#Food
???
It is possible with tables:

Code: Select all

t = {1,2,3}
a = #t
print (a)
3
u wot m8
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: A good OO lib

Post by nevon »

rokit boy wrote:Do you mean:

Code: Select all

#Food
???
It is possible with tables:

Code: Select all

t = {1,2,3}
a = #t
print (a)
3
Why don't you just try it and find out...?
Last edited by nevon on Mon Apr 02, 2012 11:56 am, edited 1 time in total.
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: A good OO lib

Post by tentus »

nevon wrote: Why don't you just try it and find out...?
Image
Kurosuke needs beta testers
User avatar
rokit boy
Party member
Posts: 198
Joined: Wed Jan 18, 2012 7:40 pm

Re: A good OO lib

Post by rokit boy »

tentus wrote:
nevon wrote: Why don't you just try it and find out...?
Image
OT much...
u wot m8
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: A good OO lib

Post by Robin »

rokit boy wrote:Do you mean:
Yes.
rokit boy wrote:It is possible with tables:
That's not what I meant: you can't change the meaning of the # operator for tables. That changes in Lua 5.2, where #foo looks at the metatable, even if foo is a table.
Help us help you: attach a .love.
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: A good OO lib

Post by tentus »

rokit boy wrote: OT much...
Maybe this will be clearer:
nevon wrote: Why don't you just try it and find out...?
Image
Kurosuke needs beta testers
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 128 guests