示例#1
0
        public int AllocID(IntPtr ptr, object o)
        {
            int index = -1;

            if (o == null)
            {
                LuaNativeMethods.lua_pushnil(ptr);
                return(index);
            }

            bool gco   = IsGcObject(o);
            bool found = gco && objMap.TryGetValue(o, out index);

            if (found)
            {
                if (LuaNativeMethods.luaS_getcacheud(ptr, index, cacheRef) == 1)
                {
                    return(-1);
                }
            }

            index = Add(o);
            return(index);
        }