aviatorscript icon indicating copy to clipboard operation
aviatorscript copied to clipboard

addFunction success but when used "Function not found"

Open TheCactuslxf opened this issue 1 year ago • 1 comments

server start, AviatorEvaluator.addFunction(abstractFunction);
abstractFunction is my function.

when server run, has error: Function not found

TheCactuslxf avatar Oct 09 '24 08:10 TheCactuslxf

@Component public class AviatorAddFunction {

private static final LOGGER LOGGER =LoggerFactory.getLogger(AviatorAddFunction.class);

private final List<AbstractFunction> functionList;

@Autowired
public AviatorAddFunction(List<AbstractFunction> functionList) {
    this.functionList = functionList;
}

public void init() {
    this.functionList.forEach(abstractFunction -> {
        LOGGER.info("AviatorAddFunction add: {}", abstractFunction.getName());
        AviatorEvaluator.addFunction(abstractFunction);
    });
}

}

程序执行时,出现如下异常: com.googlecode.aviator.exception.FunctionNotFoundException: Function not found: path

TheCactuslxf avatar Oct 09 '24 08:10 TheCactuslxf

Please ensure that the path function exists and add it to the AviatorEvaluator before compiling or executing the expression.

killme2008 avatar Nov 20 '24 14:11 killme2008