lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 25/06/2011 20:55, HyperHacker wrote:
With 5.2 getting so near completion, I feel it's worth bringing up a
couple small enhancement ideas I had in hopes they might be considered
for inclusion in the official release:

One thing that I'd love to have is the ability to get the hash of a string:

const char* lua_tohstring( lua_State *L, int index, unsigned int *hash );

When writing bindings I usually get the key string in __index/__newindex metamethods and compute some hash with them which then I use in a switch. It would be nice if I could save the time spent in computing this hash since Lua already has one.

And no, I'm not concerned with the internal hash function changing over time, a shipped product will never be patched to a newer Lua version. And even if it does, the hashes in the switch statements will be updated too.

Cheers,

Andre