It won’t work the way you are doing it, but you are close. The reason you have to use a global
is that you aren’t setting your $meta variable with the information returned from the filter.
This:
do_action('alter_loop',$meta);
Should be this:
$meta = apply_filters('alter_loop',$meta);
Note: “Actions” do not return values. “Actions” do things. “Filters” accept data and return it.
Related:
https://wordpress.stackexchange.com/a/103644/21376
https://wordpress.stackexchange.com/a/1008/21376