MCPcopy Create free account
hub / github.com/Tencent/xLua / Check

Method Check

Assets/XLua/Src/ObjectPool.cs:137–162  ·  view source on GitHub ↗
(int check_pos, int max_check, Func<object, bool> checker, Dictionary<object, int> reverse_map)

Source from the content-addressed store, hash-verified

135 }
136
137 public int Check(int check_pos, int max_check, Func<object, bool> checker, Dictionary<object, int> reverse_map)
138 {
139 if (count == 0)
140 {
141 return 0;
142 }
143 for (int i = 0; i < Math.Min(max_check, count); ++i)
144 {
145 check_pos %= count;
146 if (list[check_pos].next == ALLOCED && !Object.ReferenceEquals(list[check_pos].obj, null))
147 {
148 if (!checker(list[check_pos].obj))
149 {
150 object obj = Replace(check_pos, null);
151 int obj_index;
152 if (reverse_map.TryGetValue(obj, out obj_index) && obj_index == check_pos)
153 {
154 reverse_map.Remove(obj);
155 }
156 }
157 }
158 ++check_pos;
159 }
160
161 return check_pos %= count;
162 }
163 }
164}

Callers 1

LuaEnv.csFile · 0.45

Calls 2

TryGetValueMethod · 0.80
RemoveMethod · 0.45

Tested by

no test coverage detected