lua-users home
lua-l archive

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


>> I have a little issue with implementing OOP with Lua. The
>> partcicular topic here is how to access a member of an
>> object ala C++, that is without having to prepend the self.
>> string before the actual member name.
>I know that issue. I decided to keep the self, after trying
>the approach below ;-)
 
Oh well ... :)

[...]

>So, provided classX has the tag for which the above
>tagmethod is set as settable, each definition
>  function classX:methodY (arg1, arg2) ...
>gets wrapped with by a closure that takes care of the currentObject.
>Looks clean to me, but the overhead may not really be worth the
>optical improvement.

Nice indeed. Since I am not very comfortable with closures, I
did not see they could be of use here. I am not sure I fully
understand your sample yet, I'll spend some time rereading it :)
Thanks a lot Stephan!

--vp