[asterisk-commits] kmoore: branch 1.8 r405090 - in /branches/1.8: ./ pbx/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 8 10:00:26 CST 2014


Author: kmoore
Date: Wed Jan  8 10:00:22 2014
New Revision: 405090

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=405090
Log:
pbx_lua: Add support for Lua 5.2

This adds support for Lua 5.2 in pbx_lua which is available on newer
operating systems.

(closes issue ASTERISK-23011)
Review: https://reviewboard.asterisk.org/r/3075/
Reported by: George Joseph
Patch by: George Joseph

Modified:
    branches/1.8/configure
    branches/1.8/configure.ac
    branches/1.8/pbx/pbx_lua.c

Modified: branches/1.8/configure.ac
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/configure.ac?view=diff&rev=405090&r1=405089&r2=405090
==============================================================================
--- branches/1.8/configure.ac (original)
+++ branches/1.8/configure.ac Wed Jan  8 10:00:22 2014
@@ -1974,7 +1974,16 @@
 		[${PWLIB_INCLUDE}], [${PWLIB_LIB}])
 fi
 
-AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h], [-lm]) 
+AST_EXT_LIB_CHECK([LUA], [lua5.2], [luaL_newstate], [lua5.2/lua.h], [-lm])
+if test "x${PBX_LUA}" = "x1" ; then
+	if test x"${LUA_DIR}" = x; then
+		LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.2"
+	else
+		LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.2"
+	fi
+fi
+
+AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h], [-lm])
 if test "x${PBX_LUA}" = "x1" ; then
 	if test x"${LUA_DIR}" = x; then
 		LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.1"
@@ -1982,9 +1991,9 @@
 		LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.1"
 	fi
 fi
-	
+
 # Some distributions (like SuSE) remove the 5.1 suffix.
-AST_EXT_LIB_CHECK([LUA], [lua], [luaL_register], [lua.h], [-lm]) 
+AST_EXT_LIB_CHECK([LUA], [lua], [luaL_openlib], [lua.h], [-lm])
 
 AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
 

Modified: branches/1.8/pbx/pbx_lua.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/pbx/pbx_lua.c?view=diff&rev=405090&r1=405089&r2=405090
==============================================================================
--- branches/1.8/pbx/pbx_lua.c (original)
+++ branches/1.8/pbx/pbx_lua.c Wed Jan  8 10:00:22 2014
@@ -847,8 +847,11 @@
 		 * table in the extensions_order table */
 		for (lua_pushnil(L); lua_next(L, context); lua_pop(L, 1)) {
 			int exten = lua_gettop(L) - 1;
-
+#if LUA_VERSION_NUM < 502
 			lua_pushinteger(L, lua_objlen(L, context_order) + 1);
+#else
+			lua_pushinteger(L, lua_rawlen(L, context_order) + 1);
+#endif
 			lua_pushvalue(L, exten);
 			lua_settable(L, context_order);
 		}
@@ -1395,9 +1398,13 @@
 	lua_remove(L, -2);  /* remove the extensions order table */
 
 	context_order_table = lua_gettop(L);
-	
+
 	/* step through the extensions looking for a match */
+#if LUA_VERSION_NUM < 502
 	for (i = 1; i < lua_objlen(L, context_order_table) + 1; i++) {
+#else
+	for (i = 1; i < lua_rawlen(L, context_order_table) + 1; i++) {
+#endif
 		int e_index_copy, match = 0;
 		const char *e;
 




More information about the asterisk-commits mailing list