lua-users home
lua-l archive

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

that is the backup plan, but I also want to be able to figure out why it isn't working.

I have figured the problem a little better:

A modification:
    const TObject *tm = luaT_gettmbyobj(L, t, TM_EXISTINGINDEX);

    //fasttm(L, h->metatable, TM_EXISTINGINDEX);
    printf("i1\n");
    if (!ttisnil(tm))
        printf("h2\n");

        if (ttisfunction(tm))
        {
            printf("h3\n");
            callTMres(L, tm, t, key);
            return L->top;
        }
   // }

    /* end HACK */

1 is always printed; 2, 3 are not. So the problem I figure has to be that it is nil. Which simply should not be from my current understanding.


On Jun 17, 2004, at 01:48, diego@tecgraf.puc-rio.br wrote:

Hi,

I am trying to install an '__existingindex' metatable method. But not
quite working.

Can't you get away with using a proxy table? That way you always get
the __index or __index in the proxy table and can refer to the real
table to check if the key is already there.

[]s,
Diego.

"Reportedly, he remarked to one of his Christian missionary friends: 'What you teach us to do is admirable, but what you teach us to believe is foolish'."
- - Referring to King Mongkut of Siam
http://en.wikipedia.org/wiki/Mongkut
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFA0Tby0noMGorKkKgRAiLxAJ9bat7jLGRl33/7q6YEOOw/28SoEwCcDxl8
vASsp9M9/EyDVrh8J02WGyo=
=JaGp
-----END PGP SIGNATURE-----