new constants 'math.maxint'/'math.minint'

This commit is contained in:
Roberto Ierusalimschy 2014-04-03 11:18:19 -03:00
parent be52f784d9
commit 8b45d9806a
1 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lmathlib.c,v 1.93 2014/03/31 19:00:52 roberto Exp roberto $ ** $Id: lmathlib.c,v 1.94 2014/04/01 14:39:55 roberto Exp roberto $
** Standard mathematical library ** Standard mathematical library
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -316,6 +316,10 @@ LUAMOD_API int luaopen_math (lua_State *L) {
lua_setfield(L, -2, "pi"); lua_setfield(L, -2, "pi");
lua_pushnumber(L, HUGE_VAL); lua_pushnumber(L, HUGE_VAL);
lua_setfield(L, -2, "huge"); lua_setfield(L, -2, "huge");
lua_pushinteger(L, LUA_MAXINTEGER);
lua_setfield(L, -2, "maxint");
lua_pushinteger(L, LUA_MININTEGER);
lua_setfield(L, -2, "minint");
return 1; return 1;
} }