Commit b2329fb5 authored by psy_commando's avatar psy_commando
Browse files

Fixed issue where variadic static method arguments wouldn't get read from cache properly

* The count of cached parameters was done wrong (I assume), so the parameter array was empty when calling a static method more than once with a variadic parameter array for some reasons.

The best way to spot the issues immediately is to try to wrap "String.Format(string, params object[])" in a static class method "Format(string, params object[])". And then call it twice in a row with any valid paramters. The second time, the parameter array will be completely empty even if data was passed to the function inside the lua script.
parent d0a17a61
...@@ -169,7 +169,7 @@ namespace NLua.Method ...@@ -169,7 +169,7 @@ namespace NLua.Method
}; };
if (_LastCalledMethod.argTypes [i].isParamsArray) { if (_LastCalledMethod.argTypes [i].isParamsArray) {
int count = index - _LastCalledMethod.argTypes.Length; int count = _LastCalledMethod.argTypes.Length - i;
Array paramArray = _Translator.TableToArray (valueExtractor, type.paramsArrayType, index, count); Array paramArray = _Translator.TableToArray (valueExtractor, type.paramsArrayType, index, count);
args [_LastCalledMethod.argTypes [i].index] = paramArray; args [_LastCalledMethod.argTypes [i].index] = paramArray;
} else { } else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment