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.
http://www.moonsharp.org
Other
1.42k stars 217 forks source link

Comparison of two UserData #333

Closed newobj closed 11 hours ago

newobj commented 11 hours ago

Howdy, I have two userdata i'm trying to compare in Lua via ==. My userdata implements IEquatable, but the Equals method I never called. How is comparisons of userdata objects performed? How can I make this work? Thanks!

newobj commented 11 hours ago

Ah, nevermind. I see that you should override the bool Equals(object? obj) method, not implement IEquatable. Working now :)

newobj commented 11 hours ago

user error.