Closed qxa792 closed 5 years ago
You need to register the types otherwise Moonsharp won't know to auto-convert for you.
See for example: https://github.com/moonsharp-devs/moonsharp/blob/master/src/Tutorial/Tutorials/Chapters/Chapter6.cs#L169
and http://www.moonsharp.org/objects.html and http://www.moonsharp.org/mapping.html have some notes about registering types.
You can also set your own Type Registration Policy (eg allow all types of namespace, all types in certain assemblies...) see https://github.com/moonsharp-devs/moonsharp/blob/master/src/MoonSharp.Interpreter/Interop/RegistrationPolicies/AutomaticRegistrationPolicy.cs for the automatic version.
UserData.RegistrationPolicy = InteropRegistrationPolicy.Automatic;
(NOT recommended if code is untrusted!)
thanks