diff --git a/src/Lua/LuaFunctionExecutionContext.cs b/src/Lua/LuaFunctionExecutionContext.cs index c6958083..db08291c 100644 --- a/src/Lua/LuaFunctionExecutionContext.cs +++ b/src/Lua/LuaFunctionExecutionContext.cs @@ -8,7 +8,7 @@ public readonly record struct LuaFunctionExecutionContext public required LuaState State { get; init; } public required LuaThread Thread { get; init; } public required int ArgumentCount { get; init; } - public int FrameBase { get; init; } + public required int FrameBase { get; init; } public SourcePosition? SourcePosition { get; init; } public string? RootChunkName { get; init; } public string? ChunkName { get; init; } diff --git a/src/Lua/Runtime/LuaVirtualMachine.cs b/src/Lua/Runtime/LuaVirtualMachine.cs index 77543cb9..ae4a72fd 100644 --- a/src/Lua/Runtime/LuaVirtualMachine.cs +++ b/src/Lua/Runtime/LuaVirtualMachine.cs @@ -143,7 +143,10 @@ await func.InvokeAsync(new() State = state, Thread = thread, ArgumentCount = 2, + FrameBase = stack.Count - 2, SourcePosition = chunk.SourcePositions[pc], + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer.AsMemory(), cancellationToken); stack.UnsafeGet(RA) = methodBuffer[0]; @@ -183,7 +186,10 @@ await func.InvokeAsync(new() State = state, Thread = thread, ArgumentCount = 2, + FrameBase = stack.Count - 2, SourcePosition = chunk.SourcePositions[pc], + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer.AsMemory(), cancellationToken); stack.UnsafeGet(RA) = methodBuffer[0]; @@ -223,7 +229,10 @@ await func.InvokeAsync(new() State = state, Thread = thread, ArgumentCount = 2, + FrameBase = stack.Count - 2, SourcePosition = chunk.SourcePositions[pc], + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer.AsMemory(), cancellationToken); stack.UnsafeGet(RA) = methodBuffer[0]; @@ -263,7 +272,10 @@ await func.InvokeAsync(new() State = state, Thread = thread, ArgumentCount = 2, + FrameBase = stack.Count - 2, SourcePosition = chunk.SourcePositions[pc], + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer.AsMemory(), cancellationToken); stack.UnsafeGet(RA) = methodBuffer[0]; @@ -308,7 +320,10 @@ await func.InvokeAsync(new() State = state, Thread = thread, ArgumentCount = 2, + FrameBase = stack.Count - 2, SourcePosition = chunk.SourcePositions[pc], + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer.AsMemory(), cancellationToken); stack.UnsafeGet(RA) = methodBuffer[0]; @@ -348,7 +363,10 @@ await func.InvokeAsync(new() State = state, Thread = thread, ArgumentCount = 2, + FrameBase = stack.Count - 2, SourcePosition = chunk.SourcePositions[pc], + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer.AsMemory(), cancellationToken); stack.UnsafeGet(RA) = methodBuffer[0]; @@ -386,7 +404,10 @@ await func.InvokeAsync(new() State = state, Thread = thread, ArgumentCount = 1, + FrameBase = stack.Count - 1, SourcePosition = chunk.SourcePositions[pc], + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer.AsMemory(), cancellationToken); stack.UnsafeGet(RA) = methodBuffer[0]; @@ -431,7 +452,10 @@ await func.InvokeAsync(new() State = state, Thread = thread, ArgumentCount = 1, + FrameBase = stack.Count - 1, SourcePosition = chunk.SourcePositions[pc], + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer.AsMemory(), cancellationToken); stack.UnsafeGet(RA) = methodBuffer[0]; @@ -489,7 +513,10 @@ await func.InvokeAsync(new() State = state, Thread = thread, ArgumentCount = 2, + FrameBase = stack.Count - 2, SourcePosition = chunk.SourcePositions[pc], + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer.AsMemory(), cancellationToken); stack.UnsafeGet(RA) = methodBuffer[0]; @@ -534,7 +561,10 @@ await func.InvokeAsync(new() State = state, Thread = thread, ArgumentCount = 2, + FrameBase = stack.Count - 2, SourcePosition = chunk.SourcePositions[pc], + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer, cancellationToken); compareResult = methodBuffer[0].ToBoolean(); @@ -584,7 +614,10 @@ await func.InvokeAsync(new() State = state, Thread = thread, ArgumentCount = 2, + FrameBase = stack.Count - 2, SourcePosition = chunk.SourcePositions[pc], + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer, cancellationToken); compareResult = methodBuffer[0].ToBoolean(); @@ -638,7 +671,10 @@ await func.InvokeAsync(new() State = state, Thread = thread, ArgumentCount = 2, + FrameBase = stack.Count - 2, SourcePosition = chunk.SourcePositions[pc], + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer, cancellationToken); compareResult = methodBuffer[0].ToBoolean(); @@ -949,6 +985,8 @@ await indexTable.InvokeAsync(new() ArgumentCount = 2, SourcePosition = chunk.SourcePositions[pc], FrameBase = stack.Count - 2, + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer, cancellationToken); return methodBuffer[0]; @@ -1007,7 +1045,10 @@ await indexTable.InvokeAsync(new() State = state, Thread = thread, ArgumentCount = 3, + FrameBase = stack.Count - 3, SourcePosition = chunk.SourcePositions[pc], + ChunkName = chunk.Name, + RootChunkName = chunk.GetRoot().Name, }, methodBuffer, cancellationToken); } finally