commit a1d0e1a11adf5fac8f30cc3cf1da6162174a5ce9
parent 897573983977e2bdfe405bd056abccc1db1e0f8d
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Wed, 18 Feb 2009 10:16:46 -0300
'log10' is deprecated now
Diffstat:
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/lmathlib.c b/lmathlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lmathlib.c,v 1.70 2007/06/21 13:48:04 roberto Exp roberto $
+** $Id: lmathlib.c,v 1.71 2009/02/18 13:06:05 roberto Exp roberto $
** Standard mathematical library
** See Copyright Notice in lua.h
*/
@@ -126,6 +126,10 @@ static int math_log (lua_State *L) {
}
static int math_log10 (lua_State *L) {
+#if !defined(LUA_COMPAT_LOG10)
+ luaL_error(L, "function " LUA_QL("log10")
+ " is deprecated; use log(x, 10) instead");
+#endif
lua_pushnumber(L, log10(luaL_checknumber(L, 1)));
return 1;
}
diff --git a/luaconf.h b/luaconf.h
@@ -1,5 +1,5 @@
/*
-** $Id: luaconf.h,v 1.100 2008/07/18 19:58:10 roberto Exp roberto $
+** $Id: luaconf.h,v 1.101 2009/02/07 12:23:15 roberto Exp roberto $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/
@@ -331,6 +331,19 @@
/*
+** {==================================================================
+** Compatibility with previous versions
+** ===================================================================
+*/
+
+/*
+@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library.
+** CHANGE it (undefine it) if as soon as you rewrite all calls 'log10(x)'
+** as 'log(x, 10)'
+*/
+#define LUA_COMPAT_LOG10
+
+/*
@@ LUA_COMPAT_API includes some macros and functions that supply some
@* compatibility with previous versions.
** CHANGE it (undefine it) if you do not need these compatibility facilities.
@@ -360,6 +373,8 @@
*/
#define LUA_COMPAT_DEBUGLIB
+/* }================================================================== */
+