Yesterday I was working on a few macros and found an error that I thought weird. I don’t believe I’ve encountered this before but my memory might be faulty or I might just be out of practice. In the case of a macro, if I try to make a tab local, I will get the following error:
antescofo~: Bad argument 1 in function @insert (got undef): a tab or map is expected [t33]
The macro code is this:
@fun_def midi2symbt($x) {
@local $y, $h
$h := []
forall $y in @size($x) {
$h := @insert($h, (@size($x) + 1), @hz2symb(@midi2hz($x[$y])))
}
return $h
}
What is the solution to make the $h tab local instead of global in similar functions?
Thank you