I know the server and client check tiles every time, but they do it in fast compiled C++ code that is alot(Not lua benchmarks but it sort of shows how much faster compiled code is when compared to an interpreted language:
here and
here) faster than anything that can be done in Lua.
Another thing you might want to keep in mind is that you probably did not use this script on a production server so you dont have 150 players moving at once.
I'm thinking about this in my own limited interpretation as Lua is not something I'm well versed in. If you have a much more efficient way to do this in Lua let me know.