Browse Source

fix: meta newindex target

Akeit0 7 months ago
parent
commit
c15dcabb68

+ 1 - 0
src/Lua/CodeAnalysis/Compilation/Parser.cs

@@ -991,6 +991,7 @@ internal class Parser : IPoolNode<Parser>, IDisposable
         p.Function = f;
         p.MainFunction();
         f.Proto.IsVarArg = true;
+        f.Proto.LineDefined = 0;
         return f.Proto.CreatePrototypeAndRelease();
     }
 

+ 2 - 1
src/Lua/Runtime/LuaVirtualMachine.cs

@@ -1338,6 +1338,7 @@ public static partial class LuaVirtualMachine
         {
             if (table.TryReadTable(out var luaTable))
             {
+                targetTable = luaTable;
                 ref var valueRef = ref (skip ? ref Unsafe.NullRef<LuaValue>() : ref luaTable.FindValue(key));
                 skip = false;
                 if (!Unsafe.IsNullRef(ref valueRef) && valueRef.Type != LuaValueType.Nil)
@@ -1366,7 +1367,7 @@ public static partial class LuaVirtualMachine
             {
                 LuaRuntimeException.AttemptInvalidOperation(GetTracebacks(context), "index", table);
             }
-
+            
             table = metatableValue;
 
         Function: