示例#1
0
        //use for struct to lua
        public void NewUserDataWithGC(object o)
        {
            GCHandle handle  = GCHandle.Alloc(o);
            IntPtr   obj_ptr = GCHandle.ToIntPtr(handle);
            IntPtr   ptr     = LuaAPI.lua_newuserdata(this.m_lua, IntPtr.Size);

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

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

            Marshal.WriteIntPtr(ptr, obj_ptr);

            return(handle);
        }