| 95 | namespace |
| 96 | { |
| 97 | bool validateActionValue(sol::object value, Type type) |
| 98 | { |
| 99 | switch (type) |
| 100 | { |
| 101 | case Type::Boolean: |
| 102 | return value.get_type() == sol::type::boolean; |
| 103 | case Type::Number: |
| 104 | return value.get_type() == sol::type::number; |
| 105 | case Type::Range: |
| 106 | if (value.get_type() != sol::type::number) |
| 107 | return false; |
| 108 | double d = value.as<double>(); |
| 109 | return 0.0 <= d && d <= 1.0; |
| 110 | } |
| 111 | throw std::invalid_argument("Unknown action type"); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | void Registry::insert(const Info& info) |