Fixed tables in script runtime functions breaking

This commit is contained in:
Deukhoofd 2019-01-26 14:03:22 +01:00
parent 65ae6f6f06
commit ee36060dd6
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 22 additions and 13 deletions

View File

@ -47,19 +47,19 @@ namespace Upsilon.BaseTypes.ScriptFunction
for (var index = 0; index < variables.Length; index++)
{
var parameter = option.Parameters[index];
var parameterSymbol = ((UserDataVariableSymbol) parameter.VariableSymbol);
var v = variables[index];
if (v == null)
{
continue;
}
System.Type parameterType;
if (v is GenericUserData ud)
parameterType = ud.GetCSharpType();
else
parameterType = v.GetType();
if (parameter.VariableSymbol is UserDataVariableSymbol parameterSymbol)
{
if (parameterSymbol.BoundTypeDefinition != null)
{
var validSymbol =
@ -79,6 +79,15 @@ namespace Upsilon.BaseTypes.ScriptFunction
}
}
}
else if (parameter.VariableSymbol is TableVariableSymbol tableVariableSymbol)
{
if (parameterType.GetScriptType() != BaseTypes.Type.Table)
{
isCompatible = false;
break;
}
}
}
if (!isCompatible)
continue;
return option;