MCPcopy Create free account
hub / github.com/OpenMW/openmw / validateActionValue

Function validateActionValue

components/lua/inputactions.cpp:97–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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)

Callers 2

insertMethod · 0.85
updateMethod · 0.85

Calls 1

get_typeMethod · 0.45

Tested by

no test coverage detected