Hi Heiko,
How can this problem be efficently solved?
Just off the top of my head, does
kpsewhich --format=texmfscript --engine=foobar hello.lua
reliably get you foobar/hello.lua?
(A couple simple tests I ran came out ok.)
I admit I haven't looked at the code to see if that idea actually makes
sense :).
karl