• ents.FindByClass
    2 replies, posted
I am having trouble using [b][url=http://wiki.garrysmod.com/?title=Ents.FindByClass]Ents.FindByClass [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]. -Client- When I use: [CODE]local AllDoors = ents.FindByClass("*door*")[/CODE] I get this: [CODE] 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 = Enti
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
Sorry, you need to Log In to post a reply to this thread.