diff options
Diffstat (limited to 'ltable.c')
-rw-r--r-- | ltable.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 2.124 2017/06/12 14:21:44 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.125 2017/06/29 15:06:44 roberto Exp roberto $ |
3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -495,7 +495,7 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { | |||
495 | if (ttisnil(key)) luaG_runerror(L, "table index is nil"); | 495 | if (ttisnil(key)) luaG_runerror(L, "table index is nil"); |
496 | else if (ttisfloat(key)) { | 496 | else if (ttisfloat(key)) { |
497 | lua_Integer k; | 497 | lua_Integer k; |
498 | if (luaV_tointeger(key, &k, 0)) { /* does index fit in an integer? */ | 498 | if (luaV_flttointeger(key, &k, 0)) { /* does index fit in an integer? */ |
499 | setivalue(&aux, k); | 499 | setivalue(&aux, k); |
500 | key = &aux; /* insert it as an integer */ | 500 | key = &aux; /* insert it as an integer */ |
501 | } | 501 | } |
@@ -604,7 +604,7 @@ const TValue *luaH_get (Table *t, const TValue *key) { | |||
604 | case LUA_TNIL: return luaO_nilobject; | 604 | case LUA_TNIL: return luaO_nilobject; |
605 | case LUA_TNUMFLT: { | 605 | case LUA_TNUMFLT: { |
606 | lua_Integer k; | 606 | lua_Integer k; |
607 | if (luaV_tointeger(key, &k, 0)) /* index is int? */ | 607 | if (luaV_flttointeger(key, &k, 0)) /* index is an integral? */ |
608 | return luaH_getint(t, k); /* use specialized version */ | 608 | return luaH_getint(t, k); /* use specialized version */ |
609 | /* else... */ | 609 | /* else... */ |
610 | } /* FALLTHROUGH */ | 610 | } /* FALLTHROUGH */ |