|
|
@@ -247,9 +247,8 @@ public sealed class LuaTable
|
|
|
// Move some of the elements of the hash part to a newly allocated array
|
|
|
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)
|
|
|
{
|
|
|
indexList.Add((index, kv.Value));
|
|
|
@@ -267,7 +266,7 @@ public sealed class LuaTable
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
static bool TryGetInteger(LuaValue value, out int integer)
|
|
|
{
|
|
|
- if (value.TryRead<double>(out var num) && MathEx.IsInteger(num))
|
|
|
+ if (value.TryReadNumber(out var num) && MathEx.IsInteger(num))
|
|
|
{
|
|
|
integer = (int)num;
|
|
|
return true;
|