Ejemplo n.º 1
0
    }                                // hide default constructor

    // create a new T object and
    // push onto the Lua stack a userdata containing a pointer to T object
    private static int new_T(Lua.lua_State L)
    {
        Lua.lua_remove(L, 1);                                 // use classname:new(), instead of classname.new()
        LWF.Button obj = LunaTraits_LWF_Button._bind_ctor(L); // call constructor for T objects
        push(L, obj, true);
        return(1);                                            // userdata containing pointer to T object
    }
Ejemplo n.º 2
0
    // garbage collection metamethod
    private static int gc_T(Lua.lua_State L)
    {
        Luna.userdataType ud = (Luna.userdataType)Lua.lua_touserdata(L, 1);

        LWF.Button obj = null;
        if (!objects[L].TryGetValue(ud.ObjectId, out obj))
        {
            return(0);
        }

        if (ud.Gc)
        {
            LunaTraits_LWF_Button._bind_dtor(obj);              // call constructor for T objects
        }
        Destroy(L, obj);
        return(0);
    }
Ejemplo n.º 3
0
    // garbage collection metamethod
    private static int gc_T(Lua.lua_State L)
    {
        byte[] d = (byte[])Lua.lua_touserdata(L, 1);
        if (d == null)
        {
            Luna.print("checkRaw: ud==nil\n"); Lua.luaL_typerror(L, 1, LunaTraits_LWF_Button.className);
        }
        Luna.userdataType ud = new Luna.userdataType(d);

        LWF.Button obj = null;
        if (!objects[L].TryGetValue(ud.ObjectId, out obj))
        {
            return(0);
        }

        if (ud.Gc)
        {
            LunaTraits_LWF_Button._bind_dtor(obj);              // call constructor for T objects
            Destroy(L, obj);
        }

        return(0);
    }