Fix passing pointers as output pointer or reference in scripting api

This commit is contained in:
Wojciech Figat
2021-12-21 18:14:46 +01:00
parent af75751bf1
commit e778fe8342
2 changed files with 6 additions and 0 deletions

View File

@@ -47,6 +47,7 @@ namespace Flax.Build.Bindings
{ "VariantType", "System.Type" },
// Mono types
{ "MObject", "object" },
{ "MonoObject", "object" },
{ "MonoReflectionType", "System.Type" },
{ "MonoType", "IntPtr" },

View File

@@ -324,6 +324,11 @@ namespace Flax.Build.Bindings
// Read parameter type and name
currentParam.Type = ParseType(ref context);
currentParam.Name = context.Tokenizer.ExpectToken(TokenType.Identifier).Value;
if (currentParam.IsOut && (currentParam.Type.IsPtr || currentParam.Type.IsRef) && currentParam.Type.Type.EndsWith("*"))
{
// Pointer to value passed as output pointer
currentParam.Type.Type = currentParam.Type.Type.Remove(currentParam.Type.Type.Length - 1);
}
// Read what's next
token = context.Tokenizer.NextToken();