| 278 | } |
| 279 | |
| 280 | void Time::SetFromTable(const sol::table& hmsTable) |
| 281 | { |
| 282 | if (!hmsTable.valid() || hmsTable.size() < 1 || hmsTable.size() > 4) |
| 283 | throw std::invalid_argument("Invalid time unit table. Expected {HH, MM, SS, [CC]}"); |
| 284 | |
| 285 | int hours = hmsTable.get_or(1, 0); |
| 286 | int minutes = hmsTable.get_or(2, 0); |
| 287 | int seconds = hmsTable.get_or(3, 0); |
| 288 | int cents = hmsTable.get_or(4, 0); |
| 289 | |
| 290 | SetFromHMSC(hours, minutes, seconds, cents); |
| 291 | } |
| 292 | } |