Replaced use of lua_opt/checkint(eger) with lua_opt/checknumber
Using lua_check/opt/tonumber() assures a non-integer number is floored when cast to an int, in contrast to lua_tointeger() which is "truncated in some non-specified way."
This commit is contained in:
@@ -99,7 +99,7 @@ int l_mouse_isDown(lua_State *L) {
|
||||
int res = 0;
|
||||
int i;
|
||||
for (i = 1; i <= n; i++) {
|
||||
int idx = luaL_checkinteger(L, i) - 1;
|
||||
int idx = luaL_checknumber(L, i) - 1;
|
||||
if (idx >= 0 && idx < MOUSE_BUTTON_MAX) {
|
||||
res |= mouse_buttonsDown[idx];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user