some functions to compat

moved 2 functions to compat.lua
* getSpectators
* doRelocate
I think utilizing the key from ipairs as index to insert to result is faster than #result+1. You might also want to consider using table.create to create the result table.