CLR types don't get converted correctly when allowing auto-registration of userdata
redxdev opened this issue · 0 comments
redxdev commented
When using automatic registration of types, the table from here isn't true for the more complex types (type/methodinfo/list/dictionary/enumerable/etc) due to ClrToScriptConversions.ObjectToDynValue
using UserData.Create
to check if the value is valid userdata.
The problem is that UserData.Create
will (almost?) always end up auto-registering whatever type you pass and never hit the block that creates the table/dictionary/method/etc.
The fix is probably to check whether the passed object is of a registered type first:
- If it is, create the userdata and return it.
- If it isn't, check it against the hardcoded CLR conversions (except maybe Enum -> integer, I'd expect that one to never hit if auto registration is on) and then try to create userdata.