diff -up asterisk-11.3.0/configure.ac.lua-52 asterisk-11.3.0/configure.ac --- asterisk-11.3.0/configure.ac.lua-52 2013-05-10 12:15:50.248880769 -0400 +++ asterisk-11.3.0/configure.ac 2013-05-10 12:15:59.435880440 -0400 @@ -2096,7 +2096,7 @@ if test "x${PBX_LUA}" = "x1" ; then 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]) diff -up asterisk-11.3.0/configure.lua-52 asterisk-11.3.0/configure --- asterisk-11.3.0/configure.lua-52 2013-05-10 12:15:41.700881074 -0400 +++ asterisk-11.3.0/configure 2013-01-30 12:46:52.000000000 -0500 @@ -26245,7 +26245,7 @@ if test "x${PBX_LUA}" != "x1" -a "${USE_ pbxlibdir="-L${LUA_DIR}" fi fi - pbxfuncname="luaL_register" + pbxfuncname="luaL_openlib" if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers AST_LUA_FOUND=yes else diff -up asterisk-11.3.0/pbx/pbx_lua.c.lua-52 asterisk-11.3.0/pbx/pbx_lua.c --- asterisk-11.3.0/pbx/pbx_lua.c.lua-52 2013-05-10 12:24:03.873863124 -0400 +++ asterisk-11.3.0/pbx/pbx_lua.c 2013-05-10 12:24:08.069862974 -0400 @@ -873,8 +873,11 @@ static int lua_sort_extensions(lua_State * 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); } @@ -1508,7 +1511,11 @@ static int lua_find_extension(lua_State 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;