From 8bb272a3e3d0693a1d587cfa3469153978ae617f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 17 Jul 2014 09:30:53 -0300 Subject: new conversion float->integer: conversion is valid only when float has an exact representation as an integer --- lauxlib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lauxlib.c') diff --git a/lauxlib.c b/lauxlib.c index 563362e5..263d9f80 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.c,v 1.264 2014/06/26 17:25:11 roberto Exp roberto $ +** $Id: lauxlib.c,v 1.265 2014/07/16 14:51:36 roberto Exp roberto $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -396,8 +396,8 @@ LUALIB_API lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number def) { static void interror (lua_State *L, int arg) { - if (lua_type(L, arg) == LUA_TNUMBER) - luaL_argerror(L, arg, "float value out of integer range"); + if (lua_isnumber(L, arg)) + luaL_argerror(L, arg, "number has no integer representation"); else tag_error(L, arg, LUA_TNUMBER); } -- cgit v1.2.3-55-g6feb