moonsharp icon indicating copy to clipboard operation
moonsharp copied to clipboard

Non-global TypeDescriptorRegistry and ExtensionMethodsRegistry

Open bplu4t2f opened this issue 8 years ago • 0 comments

If a process hosts Lua scripts of different trust levels with Moonsharp, it is not possible to have different types and extension methods registered for each script because the TypeDescriptorRegistry and ExtensionMethodsRegistry use only static state.

This could be fixed by allowing the user to pass a registration instance to the Script constructor, which is then consoluted when resolving types or extension methods.

Retaining API compatibility is difficult currently, public method exists that are neither a property of Script nor do they take a Script parameter (e.g. UserData.Create). It should be possible to circumvented this if acquisition of type descriptors is lazy (e.g. in Table.Set instead of UserData.Create).

bplu4t2f avatar Feb 05 '17 17:02 bplu4t2f