Does a trick like this exist for lua modules?

Why exactly do you want to achieve this? The way you want to go for is a bad approach 99% of the time.

Yes, there is a trick for it and I can explain it in detail if you really want to do it.