In some Unity versions, IL2CPP doesn't handle LINQ very well. The example code to register your C# methods with Lua uses an class that uses LINQ. If you can't update to a Unity version whose IL2CPP handles LINQ better, you can bypass the extension class and use this alternate syntax:
Code: Select all
using System.Reflection; // Put at top of script.
...
var methodInfo = this.GetType().GetMethod(nameof(YourMethodName), BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
Lua.RegisterFunction(nameof(YourMethodName), null, methodInfo);