[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua OS!
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 22 Dec 2009 17:40:55 +0200
On Tue, Dec 22, 2009 at 5:35 PM, Timothy Baldridge <firstname.lastname@example.org> wrote:
> That would be awesome! I didn't know that sort of thing was possible in Lua.
> <-- needs to read up more on Lua kung-fu.
You have complete control on method lookup; the object's metatable has
a __index field which can either be a table _or_ a function. The
standard OOP trick is to make that __index point to the metatable
itself, which gets filled with your methods. But if it's a function,
it can intercept the 'message' and package it in an appropriate form
for remote dispatch. It really is only limited by our imagination!