You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling those methods from Lua - async void has no effect, script just go on, without awaiting; and async Task throws an exception: ScriptRuntimeException: cannot convert clr type System.Threading.Tasks.Task`1[System.Threading.Tasks.VoidTaskResult] MoonSharp.Interpreter.Interop.Converters.ClrToScriptConversions.ObjectToDynValue
For the time being i'm using callbacks as a workaround, but i don't feel that's a good solution. For example using a C# async method with a callback makes the whole Lua script an async one - now also C# method is not awaiting.
As far as i can see there's also Function.CallAsync() but it's not working for me, as Unity is throwing exceptions about using it's apis from different threads.
Dunno, maybe it's me being stupid, but i don't know how to make it work.
I've also made a question on SO but it looks like nobody knows.
The text was updated successfully, but these errors were encountered:
I'm unable to make my Lua / MoonSharp code to work with C# async / await.
What i've tried is basically:
When calling those methods from Lua -
async void
has no effect, script just go on, without awaiting; andasync Task
throws an exception:ScriptRuntimeException: cannot convert clr type System.Threading.Tasks.Task`1[System.Threading.Tasks.VoidTaskResult] MoonSharp.Interpreter.Interop.Converters.ClrToScriptConversions.ObjectToDynValue
For the time being i'm using callbacks as a workaround, but i don't feel that's a good solution. For example using a C# async method with a callback makes the whole Lua script an async one - now also C# method is not awaiting.
As far as i can see there's also
Function.CallAsync()
but it's not working for me, as Unity is throwing exceptions about using it's apis from different threads.Dunno, maybe it's me being stupid, but i don't know how to make it work.
I've also made a question on SO but it looks like nobody knows.
The text was updated successfully, but these errors were encountered: