moonsharp-devs / moonsharp

An interpreter for the Lua language, written entirely in C# for the .NET, Mono, Xamarin and Unity3D platforms, including handy remote debugger facilities.

Home Page:http://www.moonsharp.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error

qxa792 opened this issue · comments

image
image
image

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