Skip to content

Commit

Permalink
Fix: FromJson (neg integers)
Browse files Browse the repository at this point in the history
  • Loading branch information
neolithos committed Jul 15, 2019
1 parent 8f0af7b commit 77e8cb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions NeoLua.Test/LuaTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1396,8 +1396,8 @@ public void TestJsonDateTime()
[TestMethod]
public void TestFromJson01()
{
dynamic t = LuaTable.FromJson("{ \"a\":true, \"b\" : false, \"c\": 10, \"d\": 1099511627776, \"e\": \"test\", \"f\": 1.0, \"g\": 1.23, \"h\": 1e10 }");
TestResult(new LuaResult(t.a, t.b, t.c, t.d, t.e, t.f, t.g, t.h), true, false, 10, 1099511627776L, "test", 1.0, 1.23, 1e10);
dynamic t = LuaTable.FromJson("{ \"a\":true, \"b\" : false, \"c\": -10, \"d\": 1099511627776, \"e\": \"test\", \"f\": 1.0, \"g\": 1.23, \"h\": 1e10 }");
TestResult(new LuaResult(t.a, t.b, t.c, t.d, t.e, t.f, t.g, t.h), true, false, -10, 1099511627776L, "test", 1.0, 1.23, 1e10);
}
} // class LuaTableTests
}
4 changes: 2 additions & 2 deletions NeoLua/LuaTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4509,9 +4509,9 @@ object ParseNumber()
return doubleValue;
}
else if (integerValue < Int32.MaxValue)
return (int)integerValue;
return isNeg ? -(int)integerValue : (int)integerValue;
else
return integerValue;
return isNeg ? -integerValue : integerValue;
} // func ParseNumber

string ParseString(bool asMember)
Expand Down

0 comments on commit 77e8cb0

Please sign in to comment.