Beispiel #1
0
        public void NewUserDataWithGC(object o)
        {
            GCHandle handle  = GCHandle.Alloc(o);
            IntPtr   obj_ptr = GCHandle.ToIntPtr(handle);
            IntPtr   ptr     = LuaAPI.lua_newuserdata(this.luaPtr, IntPtr.Size);

            Marshal.WriteIntPtr(ptr, obj_ptr);
            SetGCFunc();
        }
Beispiel #2
0
        private GCHandle NewUserData(object o)
        {
            GCHandle handle  = GCHandle.Alloc(o);
            IntPtr   obj_ptr = GCHandle.ToIntPtr(handle);

            IntPtr ptr = LuaAPI.lua_newuserdata(this.luaPtr, IntPtr.Size);

            Marshal.WriteIntPtr(ptr, obj_ptr);

            return(handle);
        }