Help in Tetris game

Who can explain to me how this code work and  make the code simple.

This is the link:

https://github.com/captivestudio/lua-tetris