lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


All 'obj:method' calls must pass 'obj' as the first parameter to function, no metter what type 'obj' is. So it's extremely wierd if it doesn't. I haven't tried this on objects, but it works well with strings and numbers. Maybe I couldn't understand what your problem is.







----- Original Message ----- From: Kenk
To: Lua list
Sent: Sunday, October 25, 2009 5:37 AM
Subject: Re: Metatables, C and Script...


Ummm... If I say yes, will you tell me I'm wrong and proceed to explain how
it works and what I'm missing?
----- Original Message ----- From: "GrayFace" <sergroj@mail.ru>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Saturday, October 24, 2009 11:26 AM
Subject: Re: Metatables, C and Script...


Are you sure?






----- Original Message ----- From: Kenk
To: Lua list
Sent: Saturday, October 24, 2009 1:29 AM
Subject: Re: Metatables, C and Script...


Okay, getting closer...

Following  page 123...

Okay... I have AWindowClass defined in script. I set a field within that
table to be another table object with a metatable I've defined in C. I 've
__index AWindowClass. AWindowClass has a .new method which takes a table and
set's that objects metatable to that of AWindowClass.

So now O=AWindowClass.new{fields and stuff} ... When
0.FunctionInProtoTypeTable() is called, it won't find it in AWindowClass and
look in the prototype's table. which it finds...Problem is, the initial
'self' state isn't be passed through...as get's done when you reference a
method with anObject:AFunction();



----- Original Message ----- From: "Kenk" <kenk@heroesent.com>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Friday, October 23, 2009 12:49 PM
Subject: Re: Metatables, C and Script...


Hmm.. I see... I think page 123 accomplishes what I'm looking to do. let me play with that...

Thanks,

Ken
----- Original Message ----- From: "Luiz Henrique de Figueiredo" <lhf@tecgraf.puc-rio.br>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Friday, October 23, 2009 11:40 AM
Subject: Re: Metatables, C and Script...


Or once you define a metatable for an object, you can't extend it at all?

A metatable is just a plain ordinary table. You can do anything to it.
OTOH, you may choose to protect it from Lua code by adding __metatable=false
to it.