diff options
Diffstat (limited to 'lmathlib.c')
-rw-r--r-- | lmathlib.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmathlib.c,v 1.106 2014/07/16 13:47:13 roberto Exp roberto $ | 2 | ** $Id: lmathlib.c,v 1.107 2014/07/17 12:30:53 roberto Exp roberto $ |
3 | ** Standard mathematical library | 3 | ** Standard mathematical library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -164,6 +164,14 @@ static int math_sqrt (lua_State *L) { | |||
164 | return 1; | 164 | return 1; |
165 | } | 165 | } |
166 | 166 | ||
167 | |||
168 | static int math_ult (lua_State *L) { | ||
169 | lua_Integer a = luaL_checkinteger(L, 1); | ||
170 | lua_Integer b = luaL_checkinteger(L, 2); | ||
171 | lua_pushboolean(L, (lua_Unsigned)a < (lua_Unsigned)b); | ||
172 | return 1; | ||
173 | } | ||
174 | |||
167 | static int math_log (lua_State *L) { | 175 | static int math_log (lua_State *L) { |
168 | lua_Number x = luaL_checknumber(L, 1); | 176 | lua_Number x = luaL_checknumber(L, 1); |
169 | lua_Number res; | 177 | lua_Number res; |
@@ -343,6 +351,7 @@ static const luaL_Reg mathlib[] = { | |||
343 | {"tointeger", math_toint}, | 351 | {"tointeger", math_toint}, |
344 | {"floor", math_floor}, | 352 | {"floor", math_floor}, |
345 | {"fmod", math_fmod}, | 353 | {"fmod", math_fmod}, |
354 | {"ult", math_ult}, | ||
346 | {"log", math_log}, | 355 | {"log", math_log}, |
347 | {"max", math_max}, | 356 | {"max", math_max}, |
348 | {"min", math_min}, | 357 | {"min", math_min}, |