Explorar el Código

Add: ArgumentsAsMemory for async methods

akeit0 hace 1 semana
padre
commit
d3fc473014
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  1. 10 0
      src/Lua/LuaFunctionExecutionContext.cs

+ 10 - 0
src/Lua/LuaFunctionExecutionContext.cs

@@ -24,6 +24,16 @@ public readonly record struct LuaFunctionExecutionContext
             return stack[^ArgumentCount..];
         }
     }
+    
+    public ReadOnlyMemory<LuaValue> ArgumentsAsMemory
+    {
+        get
+        {
+            var stack = State.Stack;
+            var memory = stack.GetBufferMemory();
+            return memory[(stack.Count-ArgumentCount)..stack.Count];
+        }
+    }
 
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     public bool HasArgument(int index)