When data is accessed through mw.LoadData, and that data contains nested tables, the # operator (which is approximately but not exactly table length) does not work correctly.
data = mw.LoadData( 'Module:MyData' );
Then asking for
Appears to be consistently wrong. I've worked up an example that seems to like to show 0 consistently:
Experimenting with more complicated versions of this (i.e. tables nested inside tables nested inside tables) led to even worse behavior that seemed to point to uninitialized memory being returned, i.e. random values. It also managed to trigger the Wikimedia Foundation Error Message in some cases with complaints about out of memory errors. I'm not really sure why.