[asterisk-commits] kmoore: branch 11 r405091 - in /branches/11: ./ pbx/

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


Author: kmoore
Date: Wed Jan  8 10:17:32 2014
New Revision: 405091

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=405091
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
........

Merged revisions 405090 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/11/   (props changed)
    branches/11/configure
    branches/11/configure.ac
    branches/11/pbx/pbx_lua.c

Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/11/configure.ac
URL: http://svnview.digium.com/svn/asterisk/branches/11/configure.ac?view=diff&rev=405091&r1=405090&r2=405091
==============================================================================
--- branches/11/configure.ac (original)
+++ branches/11/configure.ac Wed Jan  8 10:17:32 2014
@@ -2093,6 +2093,15 @@
 		[${PWLIB_INCLUDE}], [${PWLIB_LIB}])
 fi
 
+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
@@ -2103,7 +2112,7 @@
 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/11/pbx/pbx_lua.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/pbx/pbx_lua.c?view=diff&rev=405091&r1=405090&r2=405091
==============================================================================
--- branches/11/pbx/pbx_lua.c (original)
+++ branches/11/pbx/pbx_lua.c Wed Jan  8 10:17:32 2014
@@ -873,8 +873,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);
 		}
@@ -1506,9 +1509,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