While strings are interned, unequal strings will require a per-character comparison.
For instance, are the following strings equal?
"indent preformatted text by 4 spaces"
"indent preformatted text by 4 spacez"
A string comparison would require comparing each character up until the last s/z.
But a hash will eliminate that immediately.
Of course, if the hash is just 64 bits, you still want to compare the strings for equality. But if using a good hashing algorithm, statistically, you don’t need to compare the entire string.
With 64 bits from a cryptographic hash, you only need to compare a handful of characters at most to be confident they are equal.
And of course, in a dictionary, hashing is a no-brainer for performance.
Note: whether Lua interns strings or not, your code cannot depend on that because your functions do not know how the strings were created (so you cannot use identity to disqualify equality).