MCPcopy Create free account
hub / github.com/DFHack/dfhack / units_getNoblePositions

Function units_getNoblePositions

library/LuaApi.cpp:2288–2306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2286}
2287
2288static 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
2308static int units_isUnitInBox(lua_State *state) {
2309 auto u = Lua::CheckDFObject<df::unit>(state, 1);

Callers

nothing calls this directly

Calls 3

PushVectorFunction · 0.85
lua_pushnilFunction · 0.85
luaL_argerrorFunction · 0.85

Tested by

no test coverage detected