浏览代码

Fix: string to number on LuaTable Array Resize

Akeit0 1 年之前
父节点
当前提交
3ae38ee4e1
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      src/Lua/LuaTable.cs

+ 1 - 2
src/Lua/LuaTable.cs

@@ -247,9 +247,8 @@ public sealed class LuaTable
         // Move some of the elements of the hash part to a newly allocated array
         // Move some of the elements of the hash part to a newly allocated array
         foreach (var kv in dictionary)
         foreach (var kv in dictionary)
         {
         {
-            if (kv.Key.TryRead<double>(out var d) && MathEx.IsInteger(d))
+            if (TryGetInteger(kv.Key, out var index))
             {
             {
-                var index = (int)d;
                 if (index > prevLength && index <= newLength)
                 if (index > prevLength && index <= newLength)
                 {
                 {
                     indexList.Add((index, kv.Value));
                     indexList.Add((index, kv.Value));