ents.FindByClass

I am having trouble using **[Ents.FindByClass

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Ents.FindByClass)**.

-Client- When I use:


local AllDoors = ents.FindByClass("*door*")

I get this:



1	=	Entity [0][worldspawn]
2	=	Player [1][{RG} Sherz]
3	=	Entity [3][class C_PlayerResource]
4	=	Entity [9][env_sprite]
5	=	Entity [10][env_sprite]
6	=	Entity [11][env_sprite]
7	=	Entity [12][env_sprite]
8	=	Entity [13][env_sprite]
9	=	Entity [18][func_breakable_surf]
10	=	Entity [19][func_breakable_surf]
11	=	Entity [20][func_breakable_surf]
12	=	Entity [21][func_breakable_surf]
13	=	Entity [22][func_breakable_surf]
14	=	Entity [23][func_breakable_surf]
15	=	Entity [24][func_breakable_surf]
16	=	Entity [25][func_breakable_surf]
17	=	Entity [26][func_breakable_surf]
18	=	Entity [27][func_breakable_surf]
19	=	Entity [28][func_breakable_surf]
20	=	Entity [29][func_breakable_surf]
21	=	Entity [30][func_breakable_surf]
22	=	Entity [31][env_sprite]
23	=	Entity [32][env_sprite]
24	=	Entity [33][env_sprite]
25	=	Entity [34][env_sprite]
26	=	Entity [35][env_sprite]
27	=	Entity [46][class C_BaseEntity]
28	=	Entity [49][class C_BaseEntity]
29	=	Entity [91][viewmodel]
30	=	Weapon [99]
31	=	Weapon [100]
32	=	Entity [130][env_sprite]
33	=	Entity [131][env_sprite]
34	=	Entity [140][env_sprite]
35	=	Entity [147][env_sprite]
36	=	Entity [149][env_sprite]
37	=	Entity [150][env_sprite]
38	=	Entity [155][env_sprite]
39	=	Entity [156][env_sprite]
40	=	Entity [157][env_sprite]
41	=	Entity [158][env_sprite]
42	=	Entity [161][env_sprite]
43	=	Entity [162][env_sprite]
44	=	Entity [163][env_sprite]
45	=	Entity [164][prop_door_rotating]
46	=	Entity [165][prop_door_rotating]
47	=	Entity [166][prop_physics]
48	=	Entity [167][prop_physics]
49	=	Entity [168][prop_door_rotating]
50	=	Entity [169][prop_dynamic]
51	=	Entity [170][prop_dynamic]
52	=	Entity [171][func_door]
53	=	Entity [172][func_door]
54	=	Entity [173][func_tracktrain]
55	=	Entity [176][class C_BaseEntity]
56	=	Entity [177][class C_BaseEntity]
57	=	Entity [182][env_sprite]
58	=	Entity [185][func_door]
59	=	Entity [186][func_door]
60	=	Entity [188][env_sprite]
61	=	Entity [189][env_sprite]
62	=	Entity [190][env_sprite]
63	=	Entity [193][env_sprite]
64	=	Entity [210][func_illusionary]
65	=	Entity [212][prop_door_rotating]
66	=	Entity [213][prop_door_rotating]
67	=	Entity [214][prop_door_rotating]
68	=	Entity [215][env_sprite]
69	=	Entity [216][env_sprite]
70	=	Entity [217][env_sprite]
71	=	Entity [218][env_sprite]
72	=	Entity [219][prop_door_rotating]
73	=	Entity [220][func_door]
74	=	Entity [222][func_door]
75	=	Entity [232][env_sprite]
76	=	Entity [234][func_illusionary]
77	=	Entity [243][prop_physics]
78	=	Entity [270][prop_door_rotating]
79	=	Entity [285][prop_door_rotating]
80	=	Entity [286][func_door]
81	=	Entity [288][prop_dynamic]
82	=	Entity [290][prop_dynamic]
83	=	Entity [292][prop_dynamic]
84	=	Entity [294][prop_dynamic]
85	=	Entity [296][env_sprite]
86	=	Entity [299][prop_door_rotating]
87	=	Entity [300][prop_door_rotating]
88	=	Entity [301][prop_dynamic]
89	=	Entity [302][prop_dynamic]
90	=	Entity [303][prop_door_rotating]
91	=	Entity [304][prop_door_rotating]
92	=	Entity [306][func_door_rotating]
93	=	Entity [307][func_door_rotating]
94	=	Entity [309][func_door_rotating]
95	=	Entity [310][func_door_rotating]
96	=	Entity [311][func_door_rotating]
97	=	Entity [312][func_door_rotating]
98	=	Entity [313][prop_door_rotating]
99	=	Entity [314][prop_door_rotating]
100	=	Entity [315][prop_door_rotating]
101	=	Entity [316][prop_door_rotating]
102	=	Entity [318][prop_door_rotating]
103	=	Entity [319][prop_door_rotating]
104	=	Entity [321][prop_door_rotating]
105	=	Entity [322][prop_door_rotating]
106	=	Entity [325][prop_door_rotating]
107	=	Entity [327][prop_door_rotating]
108	=	Entity [328][class C_BaseEntity]
109	=	Entity [329][prop_door_rotating]
110	=	Entity [330][prop_door_rotating]
111	=	Entity [331][prop_door_rotating]
112	=	Entity [332][prop_door_rotating]
113	=	Entity [333][func_breakable_surf]
114	=	Entity [334][func_breakable_surf]
115	=	Entity [335][func_breakable_surf]
116	=	Entity [336][func_breakable_surf]
117	=	Entity [337][func_breakable_surf]
118	=	Entity [338][func_breakable_surf]
119	=	Entity [339][func_breakable_surf]
120	=	Entity [340][func_breakable_surf]
121	=	Entity [341][func_breakable_surf]
122	=	Entity [342][func_breakable_surf]
123	=	Entity [343][func_breakable_surf]
124	=	Entity [344][func_breakable_surf]
125	=	Entity [345][prop_door_rotating]
126	=	Entity [346][prop_door_rotating]
127	=	Entity [347][func_door_rotating]
128	=	Entity [348][func_door_rotating]
129	=	Entity [349][prop_door_rotating]
130	=	Entity [350][prop_door_rotating]
131	=	Entity [351][prop_door_rotating]
132	=	Entity [352][prop_door_rotating]
133	=	Entity [353][env_sprite]
134	=	Entity [354][env_sprite]
135	=	Entity [355][class C_BaseEntity]
136	=	Entity [356][class C_BaseEntity]
137	=	Entity [358][prop_door_rotating]
138	=	Entity [359][prop_door_rotating]
139	=	Entity [361][func_breakable_surf]
140	=	Entity [362][func_breakable_surf]
141	=	Entity [363][func_breakable_surf]
142	=	Entity [364][prop_dynamic]
143	=	Entity [365][prop_door_rotating]
144	=	Entity [366][func_breakable_surf]
145	=	Entity [367][func_breakable_surf]
146	=	Entity [368][func_breakable_surf]
147	=	Entity [376][func_breakable_surf]
148	=	Entity [377][func_breakable_surf]
149	=	Entity [378][class C_BaseEntity]
150	=	Entity [379][class C_BaseEntity]
151	=	Entity [380][class C_BaseEntity]
152	=	Entity [381][class C_BaseEntity]
153	=	Entity [382][class C_BaseEntity]
154	=	Entity [383][class C_BaseEntity]
155	=	Entity [384][class C_BaseEntity]
156	=	Entity [385][class C_BaseEntity]
157	=	Entity [386][class C_BaseEntity]
158	=	Entity [387][class C_BaseEntity]
159	=	Entity [388][class C_BaseEntity]
160	=	Entity [389][class C_BaseEntity]
161	=	Entity [390][class C_BaseEntity]
162	=	Entity [391][class C_BaseEntity]
163	=	Entity [392][class C_BaseEntity]
164	=	Entity [393][func_breakable_surf]
165	=	Entity [394][func_breakable_surf]
166	=	Entity [395][func_breakable_surf]
167	=	Entity [396][func_breakable_surf]
168	=	Entity [397][class C_BaseEntity]
169	=	Entity [398][class C_BaseEntity]
170	=	Entity [402][prop_door_rotating]
171	=	Entity [403][func_breakable_surf]
172	=	Entity [404][func_breakable_surf]
173	=	Entity [405][prop_door_rotating]
174	=	Entity [406][func_breakable_surf]
175	=	Entity [407][func_breakable_surf]
176	=	Entity [414][func_breakable_surf]
177	=	Entity [427][class C_BaseEntity]
178	=	Entity [433][class C_BaseEntity]
179	=	Entity [436][env_sprite]
180	=	Entity [441][env_sprite]
181	=	Entity [442][env_sprite]
182	=	Entity [443][env_sprite]
183	=	Entity [448][class C_BaseEntity]
184	=	Entity [449][class C_BaseEntity]
185	=	Entity [450][class C_BaseEntity]
186	=	Entity [451][class C_BaseEntity]
187	=	Entity [452][class C_BaseEntity]
188	=	Entity [470][func_breakable_surf]
189	=	Entity [471][func_breakable_surf]
190	=	Entity [472][env_sprite]
191	=	Entity [473][env_sprite]
192	=	Entity [474][env_sprite]
193	=	Entity [475][env_sprite]
194	=	Entity [476][env_sprite]
195	=	Entity [477][env_sprite]
196	=	Entity [485][env_sprite]
197	=	Entity [486][env_sprite]
198	=	Entity [487][env_sprite]
199	=	Entity [488][env_sprite]
200	=	Entity [489][env_sprite]
201	=	Entity [490][env_sprite]
202	=	Entity [491][env_sprite]
203	=	Entity [492][env_sprite]
204	=	Entity [493][class C_BaseEntity]
205	=	Entity [494][class C_BaseEntity]
206	=	Entity [496][prop_door_rotating]
207	=	Entity [499][env_sprite]
208	=	Entity [500][env_sprite]
209	=	Entity [501][env_sprite]
210	=	Entity [502][env_sprite]
211	=	Entity [504][class C_BaseEntity]
212	=	Entity [505][class C_BaseEntity]
213	=	Entity [509][env_sprite]
214	=	Entity [510][func_breakable_surf]
215	=	Entity [511][func_breakable_surf]
216	=	Entity [512][func_breakable_surf]
217	=	Entity [513][func_breakable_surf]
218	=	Entity [514][func_breakable_surf]
219	=	Entity [515][func_breakable_surf]
220	=	Entity [516][func_breakable_surf]
221	=	Entity [517][func_breakable_surf]
222	=	Entity [518][func_breakable_surf]
223	=	Entity [538][class C_BaseEntity]
224	=	Entity [541][class C_BaseEntity]
225	=	Entity [544][env_sprite]
226	=	Entity [546][env_sprite]
227	=	Entity [549][env_sprite]
228	=	Entity [550][env_sprite]
229	=	Entity [561][env_sprite]
230	=	Entity [565][prop_door_rotating]
231	=	Entity [566][prop_door_rotating]
232	=	Entity [567][prop_physics]
233	=	Entity [605][class C_ShadowControl]
234	=	Entity [606][class C_Sun]
235	=	Entity [617][class C_BaseEntity]
236	=	Entity [661][class C_BaseEntity]
237	=	Entity [662][class C_BaseEntity]
238	=	Entity [663][class C_BaseEntity]
239	=	Entity [664][class C_BaseEntity]
240	=	Entity [676][phys_bone_follower]
241	=	Entity [677][phys_bone_follower]
242	=	Entity [690][class C_BaseEntity]
243	=	Entity [691][class C_BaseEntity]
244	=	Entity [711][class C_BaseEntity]
245	=	Entity [712][class C_BaseEntity]
246	=	Entity [719][class C_BaseEntity]
247	=	Entity [720][class C_BaseEntity]
248	=	Entity [721][func_door_rotating]
249	=	Entity [722][prop_dynamic]
250	=	Entity [723][prop_dynamic]
251	=	Entity [724][func_door_rotating]
252	=	Entity [725][prop_dynamic]
253	=	Entity [726][func_door_rotating]
254	=	Entity [733][func_door]
255	=	Entity [734][func_door]
256	=	Entity [735][func_breakable_surf]
257	=	Entity [736][func_breakable_surf]
258	=	Entity [737][prop_door_rotating]
259	=	Entity [739][prop_door_rotating]
260	=	Entity [740][func_breakable_surf]
261	=	Entity [741][func_door]
262	=	Entity [742][func_breakable_surf]
263	=	Entity [745][prop_dynamic]
264	=	Entity [747][prop_dynamic]
265	=	Entity [748][prop_dynamic]
266	=	Entity [751][prop_dynamic]
267	=	Entity [752][class C_BaseEntity]
268	=	Entity [753][prop_door_rotating]
269	=	Entity [778][class C_BaseEntity]
270	=	Entity [783][prop_physics]
271	=	Entity [791][prop_door_rotating]
272	=	Entity [793][prop_door_rotating]
273	=	Entity [798][class C_BaseEntity]
274	=	Entity [799][class C_BaseEntity]
275	=	Entity [811][class C_BaseEntity]
276	=	Entity [813][env_sprite]
277	=	Entity [814][env_sprite]
278	=	Entity [821][prop_door_rotating]
279	=	Entity [894][class C_BaseEntity]
280	=	Entity [895][class C_WaterLODControl]
281	=	Entity [901][class C_SpotlightEnd]
282	=	Entity [902][beam]
283	=	Entity [909][class C_SpotlightEnd]
284	=	Entity [910][beam]
285	=	Entity [16][func_breakable_surf]
286	=	Entity [17][func_breakable_surf]
287	=	Entity [221][class C_BaseEntity]
288	=	Entity [223][prop_physics]
289	=	Entity [287][func_door]
290	=	Entity [743][func_door]
291	=	Entity [206][prop_door_rotating]
292	=	Entity [207][prop_door_rotating]
293	=	Entity [260][prop_door_rotating]
294	=	Entity [305][prop_physics_multiplayer]
295	=	Entity [308][prop_physics_multiplayer]
296	=	Entity [559][prop_door_rotating]
297	=	Entity [738][class C_BaseEntity]
298	=	Entity [80][prop_physics]
299	=	Entity [81][prop_physics]
300	=	Entity [83][prop_physics]
301	=	Entity [84][prop_physics]
302	=	Entity [85][prop_physics]
303	=	Entity [86][prop_physics]
304	=	Entity [87][prop_physics]
305	=	Entity [687][func_door]
306	=	Entity [688][prop_door_rotating]
307	=	Entity [689][prop_door_rotating]
308	=	Entity [732][prop_door_rotating]
309	=	Entity [768][prop_physics]
310	=	Entity [769][prop_physics]
311	=	Entity [774][prop_physics]
312	=	Entity [775][prop_physics]
313	=	Entity [779][prop_door_rotating]
314	=	Entity [780][prop_physics]
315	=	Entity [781][prop_physics]
316	=	Entity [784][prop_door_rotating]
317	=	Entity [788][prop_physics]
318	=	Entity [789][prop_physics]
319	=	Entity [790][prop_physics]
320	=	Entity [800][prop_physics]
321	=	Entity [801][prop_physics]
322	=	Entity [804][prop_physics]
323	=	Entity [805][prop_door_rotating]
324	=	Entity [862][prop_physics]
325	=	Entity [685][func_door]
326	=	Entity [579][func_door]
327	=	Entity [38][class C_BaseEntity]
328	=	Entity [42][class C_BaseEntity]
329	=	Entity [52][class C_BaseEntity]
330	=	Entity [124][prop_dynamic]
331	=	Entity [238][prop_physics_multiplayer]
332	=	Entity [239][prop_physics_multiplayer]
333	=	Entity [280][prop_door_rotating]
334	=	Entity [317][prop_door_rotating]
335	=	Entity [320][prop_door_rotating]
336	=	Entity [357][prop_door_rotating]
337	=	Entity [360][prop_door_rotating]
338	=	Entity [198][prop_door_rotating]
339	=	Entity [545][prop_door_rotating]
340	=	Entity [792][prop_door_rotating]
341	=	Entity [74][prop_physics]
342	=	Entity [77][prop_physics]
343	=	Entity [88][prop_physics]

When using


PrintTable(AllDoors)

Seems it doesn’t like wildcards in the beginning of the string, just search for them one class at a time and merge the returned tables.

[lua]
function ents.GetDoors()
local doors = {}
for k,v in pairs(ents.GetAll()) do
if( string.match(string.lower(v:GetClass()), “door”) ) then
table.insert(doors, v)
end
end
return doors
end
AllDoors = ents.GetDoors();
[/lua]

Untested