Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matching functionality with Linq Eval #13

Open
Ezzuna opened this issue Feb 18, 2022 · 1 comment
Open

Matching functionality with Linq Eval #13

Ezzuna opened this issue Feb 18, 2022 · 1 comment

Comments

@Ezzuna
Copy link

Ezzuna commented Feb 18, 2022

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.

@deniszykov
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants