static int ScanExtensions( extensions_manager_t *p_this );
static int ScanLuaCallback( vlc_object_t *p_this, const char *psz_script,
- lua_State *L, void *pb_continue );
+ void *pb_continue );
static int Control( extensions_manager_t *, int, va_list );
static int GetMenuEntries( extensions_manager_t *p_mgr, extension_t *p_ext,
char ***pppsz_titles, uint16_t **ppi_ids );
vlc_mutex_init( &p_mgr->lock );
vlc_mutex_init( &p_mgr->p_sys->lock );
- /* Initialise Lua state structure */
- lua_State *L = GetLuaState( p_mgr, NULL );
- if( !L )
- {
- free( p_sys );
- return VLC_EGENERIC;
- }
- p_sys->L = L;
-
/* Scan available Lua Extensions */
if( ScanExtensions( p_mgr ) != VLC_SUCCESS )
{
return VLC_EGENERIC;
}
- lua_close( L );
- p_sys->L = NULL;
-
// Create the dialog-event variable
var_Create( p_this, "dialog-event", VLC_VAR_ADDRESS );
var_AddCallback( p_this, "dialog-event",
msg_Dbg( p_mgr, "All extensions are now deactivated" );
ARRAY_RESET( p_mgr->p_sys->activated_extensions );
- if( p_mgr->p_sys && p_mgr->p_sys->L )
- lua_close( p_mgr->p_sys->L );
-
vlc_mutex_destroy( &p_mgr->lock );
vlc_mutex_destroy( &p_mgr->p_sys->lock );
free( p_mgr->p_sys );
vlclua_scripts_batch_execute( VLC_OBJECT( p_mgr ),
"extensions",
&ScanLuaCallback,
- p_mgr->p_sys->L, &b_true );
+ &b_true );
if( !i_ret )
return VLC_EGENERIC;
* @param pb_continue bool* that indicates whether to continue batch or not
**/
int ScanLuaCallback( vlc_object_t *p_this, const char *psz_script,
- lua_State *L, void *pb_continue )
+ void *pb_continue )
{
extensions_manager_t *p_mgr = ( extensions_manager_t* ) p_this;
bool b_ok = false;
vlc_cond_init( &p_ext->p_sys->wait );
/* Load and run the script(s) */
+ lua_State *L = luaL_newstate();
if( luaL_dofile( L, psz_script ) )
{
msg_Warn( p_mgr, "Error loading script %s: %s", psz_script,
b_ok = true;
exit:
+ lua_close( L );
if( !b_ok )
{
free( p_ext->psz_name );