| 2286 | } |
| 2287 | |
| 2288 | static int units_getNoblePositions(lua_State *L) { |
| 2289 | vector<Units::NoblePosition> np; |
| 2290 | |
| 2291 | if (auto unit = Lua::GetDFObject<df::unit>(L, 1)) { |
| 2292 | if (Units::getNoblePositions(&np, unit)) |
| 2293 | Lua::PushVector(L, np); |
| 2294 | else |
| 2295 | lua_pushnil(L); |
| 2296 | } |
| 2297 | else if (auto hf = Lua::GetDFObject<df::historical_figure>(L, 1)) { |
| 2298 | if (Units::getNoblePositions(&np, hf)) |
| 2299 | Lua::PushVector(L, np); |
| 2300 | else |
| 2301 | lua_pushnil(L); |
| 2302 | } |
| 2303 | else |
| 2304 | luaL_argerror(L, 1, "Expected a unit or a historical figure"); |
| 2305 | return 1; |
| 2306 | } |
| 2307 | |
| 2308 | static int units_isUnitInBox(lua_State *state) { |
| 2309 | auto u = Lua::CheckDFObject<df::unit>(state, 1); |
nothing calls this directly
no test coverage detected