Merged in neo2buha/premake-dev (pull request #117)
Use seed for hashing
This commit is contained in:
parent
35b652557a
commit
05712c4ce7
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user