Lua has built-in string hashing functionality for storage of strings inside its maps. It is possible to access it?
Or is there another string hash function already available in the l开发者_JAVA百科ua language/libraries?
The hash function is not exposed. By hiding the hash function, the Lua designers reserve the right to change it out from under you. For example, they may one day try "cuckoo hashing", which may work better with a different hash function.
If you want a hash function for storage into a hash table, you will be better off just using a Lua table as your data structure. If you want a hash function to serialize something to disk, you might consider the Kepler project's implementation of MD5 hashing for Lua.
There's no API for direct access to the internal hash function in the Lua core. Why can't you use a Lua table instead?
精彩评论