Пример #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.Point obj = LunaTraits_LWF_Point._bind_ctor(L); // call constructor for T objects
        push(L, obj, true);
        return(1);                                          // userdata containing pointer to T object
    }
Пример #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.Point obj = null;
        if (!objects[L].TryGetValue(ud.ObjectId, out obj))
        {
            return(0);
        }

        if (ud.Gc)
        {
            LunaTraits_LWF_Point._bind_dtor(obj);              // call constructor for T objects
        }
        Destroy(L, obj);
        return(0);
    }
Пример #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_Point.className);
        }
        Luna.userdataType ud = new Luna.userdataType(d);

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

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

        return(0);
    }