| 189 | |
| 190 | template <typename EntityT> |
| 191 | LuaTable entityQuery(World* world, |
| 192 | LuaEngine& engine, |
| 193 | Vec2F const& pos1, |
| 194 | LuaValue const& pos2, |
| 195 | Maybe<LuaTable> options, |
| 196 | Selector<EntityT> selector = {}) { |
| 197 | if (!options) |
| 198 | options = engine.createTable(); |
| 199 | |
| 200 | if (auto radius = engine.luaMaybeTo<float>(pos2)) { |
| 201 | Vec2F center = pos1; |
| 202 | options->set("center", center); |
| 203 | options->set("radius", *radius); |
| 204 | return entityQueryImpl<EntityT>(world, engine, *options, selector); |
| 205 | } else { |
| 206 | RectF rect(pos1, engine.luaTo<Vec2F>(pos2)); |
| 207 | options->set("rect", rect); |
| 208 | return entityQueryImpl<EntityT>(world, engine, *options, selector); |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | template <typename EntityT> |
| 213 | LuaTable entityLineQuery(World* world, |
no test coverage detected