Open
Description
Hello!
Dictionary<string, Func<object>> varMap = new() {
["sec"] = () => DateTime.Now.Second
};
var calc = Funny.WithFunction("vars", (string name) => varMap[name]()).BuildForCalcConstant();
var result = calc.Calc("1 + vars('sec')");
Console.WriteLine(result);
These codes will cause NFun.Exceptions.FunnyParseException:“Invalid operator call argument: +(T0, T0)->T0. Expected: T0”
.
I want to cast or convert the object{int}
type to integer
or real
type, but I didn't found the usage in the examples.
Can you show me how to do this ?
Thanks !