csharp-eval-unity3d
csharp-eval-unity3d copied to clipboard
Matching functionality with Linq Eval
Hey, was really hoping you could help. I picked up this plugin to try and match functionality we had in place before moving over to the IL2CPP scripting backend.
The function I'm trying to replicate is as below.
LambdaParser.Linq.LambdaParse.Eval(string expr, IDictionary<string,object> vars) T Output = Assets.Scripts.SysExtensions.Extensions.TryCast<T>(res);
Using the above function with correct fed variables was matching my needed functionality perfectly. How would I go about achieving this in this plugin?
Thanks, Ezzuna.
Hi @Ezzuna. Yes, you could use following code:
var result = CSharp.CSharpExpression.Evaluate<int, int, int, int>
(
expression: "x + y + z",
arg1: 2,
arg1Name: "x",
arg2: 3,
arg2Name: "y",
arg3: 10,
arg3Name: "y"
);
or pass object if you need more than 3 parameters.