From 81245b1ad51c5f4a4dd71da272b65b2450929b80 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 20 Feb 2015 12:27:53 -0200 Subject: 'numisinteger' (for table keys) replaced by 'luaV_tointeger' (old 'tointeger_aux'), which can do the same job. --- lvm.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'lvm.c') diff --git a/lvm.c b/lvm.c index 64bf883b..f40c1e95 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.233 2015/01/16 16:54:37 roberto Exp roberto $ +** $Id: lvm.c,v 2.234 2015/02/05 17:15:33 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -31,16 +31,6 @@ #include "lvm.h" -/* -** You can define LUA_FLOORN2I if you want to convert floats to integers -** by flooring them (instead of raising an error if they are not -** integral values) -*/ -#if !defined(LUA_FLOORN2I) -#define LUA_FLOORN2I 0 -#endif - - /* limit for table tag-method chains (to avoid loops) */ #define MAXTAGLOOP 2000 @@ -89,7 +79,7 @@ int luaV_tonumber_ (const TValue *obj, lua_Number *n) { ** mode == 1: takes the floor of the number ** mode == 2: takes the ceil of the number */ -static int tointeger_aux (const TValue *obj, lua_Integer *p, int mode) { +int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode) { TValue v; again: if (ttisfloat(obj)) { @@ -115,14 +105,6 @@ static int tointeger_aux (const TValue *obj, lua_Integer *p, int mode) { } -/* -** try to convert a value to an integer -*/ -int luaV_tointeger_ (const TValue *obj, lua_Integer *p) { - return tointeger_aux(obj, p, LUA_FLOORN2I); -} - - /* ** Try to convert a 'for' limit to an integer, preserving the ** semantics of the loop. @@ -141,7 +123,7 @@ int luaV_tointeger_ (const TValue *obj, lua_Integer *p) { static int forlimit (const TValue *obj, lua_Integer *p, lua_Integer step, int *stopnow) { *stopnow = 0; /* usually, let loops run */ - if (!tointeger_aux(obj, p, (step < 0 ? 2 : 1))) { /* not fit in integer? */ + if (!luaV_tointeger(obj, p, (step < 0 ? 2 : 1))) { /* not fit in integer? */ lua_Number n; /* try to convert to float */ if (!tonumber(obj, &n)) /* cannot convert to float? */ return 0; /* not a number */ -- cgit v1.2.3-55-g6feb