GetHashKey treats a string (containing only digits) as an integer

The recent change to GetHashKey

Causes GetHashKey to treat a string value which contains digits only as an integer, and returns 0

This causes several issues where vehicles, models and labels containing digits only to completely break and stop working.
Commonly for (custom) plane models, their model name is a number representation of their real type.
For example, the 737-200 which has the model name 737200 in-game is no longer spawnable unless using the hash directly (which cannot be obtained by the client).

(Server doesn’t run updated code, so the server can GetHashKey the value while the client cannot)

Now the root cause here seems to be that the lua_isnumber converts a string value into a number
https://pgl.yoyo.org/luai/i/lua_isnumber

A possible fix would be to make sure the value is an integer and not a string
With no actual knowledge, but from reading the document linked above, this may be possible by changing the evaluation to (something in the lines of):

if (lua_isnil(L, 2) || lua_equal(L, 2, lua_tointeger(L, 2)))

Essentially, the issue is that it considers string values as numbers when it probably shouldn’t

1 Like

Issue seems to be resolved as of

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.