Lua support for compile-time Jenkins hashes

Originally published at:

In GTA/RAGE games, you’ll often encounter native functions either taking or returning a Jenkins one-at-a-time hash, like the ones returned by GET_HASH_KEY. Traditionally, code would have had to either hardcode hashes (like -1044093321), or use GET_HASH_KEY directly (like GetHashKey(“a_m_y_skater_01”)). This would have lead to either less readability and maintainability, or having to wait for a…


How i am supposed to use that on value exemple below.

This works :

This don’t work :
local snailLoveSkate = “a_m_y_skater_01”

If it’s already in a variable, you have to GetHashKey it.

Might of missed the mark here…

Given the content of the post, I believe the back tick is just doing some conversion under the hood, just doing it in a better way.

So `a_m_y_skater_01` is the same as doing GetHashKey("a_m_y_skater_01") but because you passed a local variable to the back ticks that is not apart of the libary it is not correct, because `a_m_y_skater_01` is not the same as `snailLoveSkate`.

I can only sumise that you made the code do GetHashKey("snailLoveSkate") instead of what you originally intended.

yeah i know that but i wanna know if there is a way in Lua to do that with string value.

I don’t believe the method they have implemented will allow it the way you’ve shown in your original post.

Can you propose an example of the implementation you’re wanting to try, this might help in finding a better method.

1 Like