lua-users home
lua-l archive

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


On Tue, Dec 22, 2009 at 5:35 PM, Timothy Baldridge <tbaldridge@gmail.com> 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!

steve d.