Merged in neo2buha/premake-dev (pull request #117)

Use seed for hashing
This commit is contained in:
Jason Perkins 2014-09-20 18:41:48 -04:00
parent 35b652557a
commit 05712c4ce7

View File

@ -1,7 +1,7 @@
/** /**
* \file string_hash.c * \file string_hash.c
* \brief Computes a hash value for a string. * \brief Computes a hash value for a string.
* \author Copyright (c) 2012 Jason Perkins and the Premake project * \author Copyright (c) 2012-2014 Jason Perkins and the Premake project
*/ */
#include "premake.h" #include "premake.h"
@ -11,7 +11,8 @@
int string_hash(lua_State* L) int string_hash(lua_State* L)
{ {
const char* str = luaL_checkstring(L, 1); const char* str = luaL_checkstring(L, 1);
lua_pushnumber(L, (lua_Number)do_hash(str, 0)); unsigned long seed = luaL_optint(L, 2, 0);
lua_pushnumber(L, do_hash(str, seed));
return 1; return 1;
} }