From: Antoine Cellerier Date: Fri, 26 Feb 2010 10:07:42 +0000 (+0100) Subject: Include all authorized lua extensions in module search path too. X-Git-Tag: 1.1.0-pre1~663 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=6a0d4bdd348dbf478bbad60fd736201b6c85dde0;p=vlc Include all authorized lua extensions in module search path too. --- diff --git a/modules/misc/lua/vlc.c b/modules/misc/lua/vlc.c index 9bf2babdb8..efe0b1f643 100644 --- a/modules/misc/lua/vlc.c +++ b/modules/misc/lua/vlc.c @@ -704,20 +704,23 @@ error: static int vlclua_add_modules_path_inner( lua_State *L, const char *psz_path ) { /* FIXME: don't use luaL_dostring */ - char *psz_command = NULL; - if( asprintf( &psz_command, - "package.path =[[%s"DIR_SEP"modules"DIR_SEP"?.lua;]]..package.path", - psz_path ) < 0 ) + for( const char **ppsz_ext = ppsz_lua_exts; *ppsz_ext; ppsz_ext++ ) { - return 1; - } + char *psz_command = NULL; + if( asprintf( &psz_command, + "package.path =[[%s"DIR_SEP"modules"DIR_SEP"?.%s;]]..package.path", + psz_path, *ppsz_ext ) < 0 ) + { + return 1; + } - if( luaL_dostring( L, psz_command ) ) - { + if( luaL_dostring( L, psz_command ) ) + { + free( psz_command ); + return 1; + } free( psz_command ); - return 1; } - free( psz_command ); return 0; }