|
|
@@ -219,7 +219,12 @@ public sealed class LuaCoroutine : LuaThread, IValueTaskSource<LuaCoroutine.Yiel
|
|
|
{
|
|
|
throw new LuaRuntimeException(context.State.GetTraceback(), "cannot call yield on a coroutine that is not currently running");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ if (context.Thread.GetCallStackFrames()[^2].Function is not Closure)
|
|
|
+ {
|
|
|
+ throw new LuaRuntimeException(context.State.GetTraceback(), "attempt to yield across a C#-call boundary");
|
|
|
+ }
|
|
|
+
|
|
|
resume.SetResult(new()
|
|
|
{
|
|
|
Results = context.Arguments.ToArray(),
|