Returning a table does just that: you get a reference to the table itself. No copying. So changes to one are a change to the “other”.
Also, if you nil the table reference anyhow, wiping its contents clean sounds unnecessary. If that’s the last reference (say, you aren’t still holding the reference in the other file), it will become unreachable and the garbage collector will deal with it at some point for you.