我想从 Lua / MoonSharp 代码中调用并等待 C# 异步方法。
例如:
1)。
async void Test1() {
await Something();
}
2)。
async Task Test2() {
await Something();
}
然后从 Lua 调用它 - 1)。不等待但继续执行脚本,以及 2)。抛出ScriptRuntimeException: cannot convert clr type System.Threading.Tasks.Task`1[System.Threading.Tasks.VoidTaskResult]
MoonSharp.Interpreter.Interop.Converters.ClrToScriptConversions.ObjectToDynValue
异常。
有什么办法可以使这项工作?