Skip to content

Commit a06c73f

Browse files
committed
Fix out parameters not working for generic methods on Lua
1 parent 3a71aa3 commit a06c73f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

MoonSharp.Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/GenericMethodMemberDescriptor.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,18 @@ protected override object[] BuildArgumentList(Script script, object obj, ScriptE
250250

251251
outParams = null;
252252

253-
for (int i = 0; i < args.Count; i++)
253+
for (int i = 0; i < parameters.Length; i++)
254254
{
255255
// keep track of out and ref params
256256
if (parameters[i].Type.IsByRef)
257257
{
258258
if (outParams == null) outParams = new List<int>();
259-
outParams.Add(i);
259+
outParams.Add(i - MethodInfo.GetGenericArguments().Length);
260260
}
261+
}
261262

263+
for (int i = 0; i < args.Count; i++)
264+
{
262265
// if an ext method, we have an obj -> fill the first param
263266
if (ExtensionMethodType != null && obj != null && i == 0)
264267
{

0 commit comments

Comments
 (0)