return VLC_SUCCESS;
}
+/**
+ * Dummy Lua function: does nothing
+ * @note This function can be used to replace "require" while scanning for
+ * extensions
+ * Even the built-in libraries are not loaded when calling descriptor()
+ **/
+static int vlclua_dummy_require( lua_State *L )
+{
+ (void) L;
+ return 0;
+}
+
/**
* Batch scan all Lua files in folder "extensions": callback
* @param p_this This extensions_manager_t object
vlc_mutex_init( &p_ext->p_sys->running_lock );
vlc_cond_init( &p_ext->p_sys->wait );
- /* Load and run the script(s) */
+ /* Prepare Lua state */
lua_State *L = luaL_newstate();
+ lua_register( L, "require", &vlclua_dummy_require );
+
+ /* Let's run it */
if( luaL_dofile( L, psz_script ) )
{
msg_Warn( p_mgr, "Error loading script %s: %s", psz_script,
p_ext->p_sys->L = L;
}
}
-#ifndef NDEBUG
- else
- {
- msg_Dbg( p_mgr, "Reusing old Lua state for extension '%s'",
- p_ext->psz_name );
- }
-#endif
return L;
}