From d30569c06407529cc6e99f4a35ae5f9bfe6fa940 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 5 Dec 2019 14:14:29 -0300 Subject: Using an enumeration for float->integer coercion modes --- ltable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ltable.c') diff --git a/ltable.c b/ltable.c index 4c7ae994..cc3c3dd4 100644 --- a/ltable.c +++ b/ltable.c @@ -626,7 +626,7 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { else if (ttisfloat(key)) { lua_Number f = fltvalue(key); lua_Integer k; - if (luaV_flttointeger(f, &k, 0)) { /* does key fit in an integer? */ + if (luaV_flttointeger(f, &k, F2Ieq)) { /* does key fit in an integer? */ setivalue(&aux, k); key = &aux; /* insert it as an integer */ } @@ -745,7 +745,7 @@ const TValue *luaH_get (Table *t, const TValue *key) { case LUA_TNIL: return &absentkey; case LUA_TNUMFLT: { lua_Integer k; - if (luaV_flttointeger(fltvalue(key), &k, 0)) /* index is an integral? */ + if (luaV_flttointeger(fltvalue(key), &k, F2Ieq)) /* integral index? */ return luaH_getint(t, k); /* use specialized version */ /* else... */ } /* FALLTHROUGH */ -- cgit v1.2.3-55-g6feb