| 1475 | } |
| 1476 | |
| 1477 | static int setConstraint(lua_State *L) |
| 1478 | { |
| 1479 | auto token = luaL_checkstring(L, 1); |
| 1480 | bool by_count = lua_toboolean(L, 2); |
| 1481 | int count = luaL_optint(L, 3, -1); |
| 1482 | int gap = luaL_optint(L, 4, -1); |
| 1483 | |
| 1484 | color_ostream &out = *Lua::GetOutput(L); |
| 1485 | update_data_structures(out); |
| 1486 | |
| 1487 | ItemConstraint *icv = get_constraint(out, token); |
| 1488 | if (!icv) |
| 1489 | luaL_error(L, "invalid constraint: %s", token); |
| 1490 | |
| 1491 | if (!lua_isnil(L, 2)) |
| 1492 | icv->setGoalByCount(by_count); |
| 1493 | if (!lua_isnil(L, 3)) |
| 1494 | icv->setGoalCount(count); |
| 1495 | if (!lua_isnil(L, 4)) |
| 1496 | icv->setGoalGap(gap); |
| 1497 | |
| 1498 | process_constraints(out); |
| 1499 | push_constraint(L, icv); |
| 1500 | return 1; |
| 1501 | } |
| 1502 | |
| 1503 | static int getCountHistory(lua_State *L) |
| 1504 | { |
nothing calls this directly
no test coverage detected