mirror of https://github.com/rusefi/lua.git
new function 'math.isfloat'
This commit is contained in:
parent
6347004be9
commit
29fe3abda2
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lmathlib.c,v 1.82 2013/01/29 16:00:40 roberto Exp roberto $
|
** $Id: lmathlib.c,v 1.83 2013/03/07 18:21:32 roberto Exp roberto $
|
||||||
** Standard mathematical library
|
** Standard mathematical library
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -230,6 +230,12 @@ static int math_randomseed (lua_State *L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int math_isfloat (lua_State *L) {
|
||||||
|
luaL_checkany(L, 1);
|
||||||
|
lua_pushboolean(L, (lua_type(L, 1) == LUA_TNUMBER && !lua_isinteger(L, 1)));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static const luaL_Reg mathlib[] = {
|
static const luaL_Reg mathlib[] = {
|
||||||
{"abs", math_abs},
|
{"abs", math_abs},
|
||||||
{"acos", math_acos},
|
{"acos", math_acos},
|
||||||
|
@ -244,6 +250,7 @@ static const luaL_Reg mathlib[] = {
|
||||||
{"floor", math_floor},
|
{"floor", math_floor},
|
||||||
{"fmod", math_fmod},
|
{"fmod", math_fmod},
|
||||||
{"frexp", math_frexp},
|
{"frexp", math_frexp},
|
||||||
|
{"isfloat", math_isfloat},
|
||||||
{"ldexp", math_ldexp},
|
{"ldexp", math_ldexp},
|
||||||
#if defined(LUA_COMPAT_LOG10)
|
#if defined(LUA_COMPAT_LOG10)
|
||||||
{"log10", math_log10},
|
{"log10", math_log10},
|
||||||
|
|
Loading…
Reference in New Issue