lua-users home
lua-l archive

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


On Wed, Dec 17, 1997 at 09:43:22PM -0200, Steve Dekorte wrote:
> I found a way to implement this for method calls (see below) but it
> causes problems for failed variable accesses (they return a the
> forward function instead of nil)

Neat trick Steve.

> I've considered doing everything with methods, but I'm not
> happy with having to do my variable set/gets with methods of
> a different name or having to move variables into a subtable.
> 
> Anyone found a better way to do this?

How about passing back a "special" table instead of "table.forward".

This "special" table would be like a forwarding block, waiting for
closure. Attach tag methods to handle:

1) Function call on the "block"
    - This would call the proper "forward" function of the original table.

2) Variable get
    - Fail? Or perhaps call some unavailable variable handler on the
      original table (if available).

3) Variable set
    - create the variable in the original table and do the set. Perhaps
      informing the table (object) of a variable creation.

... you get the idea...

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net