We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6eeed8d commit 5594879Copy full SHA for 5594879
1 file changed
LuaGObject/marshal.c
@@ -21,6 +21,9 @@ static lua_Number
21
check_integer(lua_State *L, int narg, lua_Number val_min, lua_Number val_max)
22
{
23
lua_Number val = luaL_checknumber(L, narg);
24
+ /* If the value is negative and the target type is unsigned, underflow it. */
25
+ if (val_min == 0 && val < 0)
26
+ val += val_max + 1;
27
if (val < val_min || val > val_max) {
28
lua_pushfstring(L, "%f is out of <%f, %f>", val, val_min, val_max);
29
luaL_argerror(L, narg, lua_tostring(L, -1));
@@ -32,6 +35,9 @@ static lua_Integer
32
35
check_integer(lua_State *L, int narg, lua_Integer val_min, lua_Integer val_max)
33
36
34
37
lua_Integer val = luaL_checkint(L, narg);
38
39
40
41
42
lua_pushfstring(L, "%I is out of <%I, %I>", val, val_min, val_max);
43
0 commit comments