it was changed in a111: "Fixed built-in variables to return numbers as Integer rather than as String."
previously the function was
https://github.com/Lexikos/AutoHotkey_L/blob/b31178da2fd65149fc1e3cdb1cf96cbd9fd0ca58/source/script2.cpp#L10541
now the function is
https://github.com/Lexikos/AutoHotkey_L/blame/6012f87b817e8823c48608960c37a77e48ca3e74/source/script2.cpp#L10402
i think it was intentional, otherwise lexikos could have easily kept
else return -1. so the docs should be changed probably
explain how
-1 was useful. its there to signal that there was no prior key. but in v1 nobody ever checked for this and simply ignored it(or they werent even aware of that distinction). now in v2, ure forced to handle it(ure still free to ignore it if u dont care about it, but it now has to be a conscious decision)