diff options
Diffstat (limited to '')
| -rw-r--r-- | ltests.c | 6 |
1 files changed, 5 insertions, 1 deletions
| @@ -1066,8 +1066,12 @@ static int tracegc (lua_State *L) { | |||
| 1066 | 1066 | ||
| 1067 | static int hash_query (lua_State *L) { | 1067 | static int hash_query (lua_State *L) { |
| 1068 | if (lua_isnone(L, 2)) { | 1068 | if (lua_isnone(L, 2)) { |
| 1069 | TString *ts; | ||
| 1069 | luaL_argcheck(L, lua_type(L, 1) == LUA_TSTRING, 1, "string expected"); | 1070 | luaL_argcheck(L, lua_type(L, 1) == LUA_TSTRING, 1, "string expected"); |
| 1070 | lua_pushinteger(L, cast_int(tsvalue(obj_at(L, 1))->hash)); | 1071 | ts = tsvalue(obj_at(L, 1)); |
| 1072 | if (ts->tt == LUA_VLNGSTR) | ||
| 1073 | luaS_hashlongstr(ts); /* make sure long string has a hash */ | ||
| 1074 | lua_pushinteger(L, cast_int(ts->hash)); | ||
| 1071 | } | 1075 | } |
| 1072 | else { | 1076 | else { |
| 1073 | TValue *o = obj_at(L, 1); | 1077 | TValue *o = obj_at(L, 1); |
