[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: OO programming with Lua
- From: "Vincent Lascaux" <vincent.lascaux@...>
- Date: Wed, 16 Jul 2003 10:24:29 +0200
Hello,
I'm new to Lua (since yesterday), so dont blame me if I say silly things
;) I know that I can use operator ':' to make the script look like object
oriented. X:A() is replaced by X.A(X). I want to export C++ object, and
with this idiom, X must have a large table to store every functions. I
think this could be a performance problem when using a lot of variable of
the same type as X. Is there a way to make this work with only one large
table ?
For example, I'd like to define a new operator (I dont know if this is
possible) '->' that would replace X->A() by functions[X.type].A(X), where
functions is a table containing a table for each type. So functions[X.type]
would be the table containing every functions associated with X.type (I
assume that I can assign to each variable a "type" value that identificate
its type).
Thanks
--
Vincent