Provide a find-indexed-fact CLIPS function that exposes FindIndexedFact via a FindIndexedFactFunction that looks something like this:
void FindIndexedFactFunction(
Environment *theEnv,
UDFContext *context,
UDFValue *returnValue)
{
Fact *fact;
UDFValue theArg;
UDFFirstArgument(context, INTEGER_BIT, &theArg);
long long id = theArg.integerValue->contents;
fact = FindIndexedFact(theEnv, id);
if (fact) {
returnValue->factValue = fact;
}
}
Added a function called fact-index-to-fact to the 6.4.2 release.