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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@405091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kinsey Moore
2014-01-08 16:17:32 +00:00
parent 05f0ad2c56
commit 10cf34d36a
3 changed files with 133 additions and 5 deletions

View File

@@ -873,8 +873,11 @@ static int lua_sort_extensions(lua_State *L)
* 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 @@ static int lua_find_extension(lua_State *L, const char *context, const char *ext
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;