| 1292 | } |
| 1293 | |
| 1294 | static int traceUnitPath(lua_State *L) |
| 1295 | { |
| 1296 | auto unit = Lua::CheckDFObject<df::unit>(L, 1); |
| 1297 | |
| 1298 | CHECK_NULL_POINTER(unit); |
| 1299 | |
| 1300 | size_t idx = 1; |
| 1301 | auto info = UnitPath::get(unit); |
| 1302 | lua_createtable(L, info->path.size(), 0); |
| 1303 | |
| 1304 | float last_time = 0.0f; |
| 1305 | for (auto it = info->path.begin(); it != info->path.end(); ++it) |
| 1306 | { |
| 1307 | Lua::Push(L, it->second); |
| 1308 | if (idx > 1) |
| 1309 | { |
| 1310 | lua_pushnumber(L, last_time); |
| 1311 | lua_setfield(L, -2, "from"); |
| 1312 | } |
| 1313 | if (idx < info->path.size()) |
| 1314 | { |
| 1315 | lua_pushnumber(L, it->first); |
| 1316 | lua_setfield(L, -2, "to"); |
| 1317 | } |
| 1318 | lua_rawseti(L, -2, idx++); |
| 1319 | last_time = it->first; |
| 1320 | } |
| 1321 | |
| 1322 | return 1; |
| 1323 | } |
| 1324 | |
| 1325 | static int unitPosAtTime(lua_State *L) |
| 1326 | { |
nothing calls this directly
no test coverage detected