Showing the changes to src/lmathlib.c (1 of 60 files). Show all
Unified · Split
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmathlib.c,v 1.90 2013/07/03 17:23:19 roberto Exp $ | 2 | ** $Id: lmathlib.c,v 1.92 2013/07/22 16:05:53 roberto Exp $ |
| 3 | ** Standard mathematical library | 3 | ** Standard mathematical library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -251,9 +251,16 @@ static int math_randomseed (lua_State *L) { · 245 unmodified lines | |||
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | 253 | ||
| 254 | static int math_isfloat (lua_State *L) { | 254 | static int math_type (lua_State *L) { |
| 255 | luaL_checkany(L, 1); | 255 | luaL_checkany(L, 1); |
| 256 | lua_pushboolean(L, (lua_type(L, 1) == LUA_TNUMBER && !lua_isinteger(L, 1))); | 256 | if (lua_type(L, 1) == LUA_TNUMBER) { |
| 257 | if (lua_isinteger(L, 1)) | ||
| 258 | lua_pushliteral(L, "integer"); | ||
| 259 | else | ||
| 260 | lua_pushliteral(L, "float"); | ||
| 261 | } | ||
| 262 | else | ||
| 263 | lua_pushnil(L); | ||
| 257 | return 1; | 264 | return 1; |
| 258 | } | 265 | } |
| 259 | 266 | ||
| @@ -273,7 +280,6 @@ static const luaL_Reg mathlib[] = { · 13 unmodified lines | |||
| 273 | {"ifloor", math_ifloor}, | 280 | {"ifloor", math_ifloor}, |
| 274 | {"fmod", math_fmod}, | 281 | {"fmod", math_fmod}, |
| 275 | {"frexp", math_frexp}, | 282 | {"frexp", math_frexp}, |
| 276 | {"isfloat", math_isfloat}, | ||
| 277 | {"ldexp", math_ldexp}, | 283 | {"ldexp", math_ldexp}, |
| 278 | #if defined(LUA_COMPAT_LOG10) | 284 | #if defined(LUA_COMPAT_LOG10) |
| 279 | {"log10", math_log10}, | 285 | {"log10", math_log10}, |
| @@ -291,6 +297,7 @@ static const luaL_Reg mathlib[] = { · 11 unmodified lines | |||
| 291 | {"sqrt", math_sqrt}, | 297 | {"sqrt", math_sqrt}, |
| 292 | {"tanh", math_tanh}, | 298 | {"tanh", math_tanh}, |
| 293 | {"tan", math_tan}, | 299 | {"tan", math_tan}, |
| 300 | {"type", math_type}, | ||
| 294 | {NULL, NULL} | 301 | {NULL, NULL} |
| 295 | }; | 302 | }; |
| 296 | 303 | ||