Does this actually matter in Lua? Aren’t all array elements going to be pointers to heap allocated objects anyways?
The point of SoA is your likely to be accessed values are adjacent in memory, but if you’re chasing a pointer to get that value then you’re not getting anything out of it.
As for the SoA approach, here you can find a small and exaggerated example: https://luajit.org/ext_ffi.html