API reference
API reference
Select your platform
No SDKs available
No versions available

WitIntValue Class

Extends WitValue
ScriptableObject asset that extracts integer values from Wit.ai JSON responses. Useful for counts, indices, numerical identifiers, and other integer data.
Usage example:
// Create in Unity Editor or via script
var countExtractor = ScriptableObject.CreateInstance<WitIntValue>();
countExtractor.path = "entities.number[0].value";
// Extract int value from response
var response = WitResponseNode.Parse("{\"entities\":{\"number\":[{\"value\":42}]}}");
int count = countExtractor.GetIntValue(response);
// Compare values
bool isFortyTwo = countExtractor.Equals(response, 42); // true
bool fromString = countExtractor.Equals(response, "42"); // also true (parsed)

Member Functions

Extracts the integer value from the response at the configured path.
Parameters
response
The Wit.ai JSON response node
Returns
The extracted integer value as an object
Compares the integer value in the response with a target value. Supports comparing with int values or parsable strings.
Parameters
response
The Wit.ai JSON response node
value
The value to compare (can be int or parsable string)
Returns
True if values are equal
Extracts the integer value from the response at the configured path.
Parameters
response
The Wit.ai JSON response node
Returns
The extracted integer value