Revert "Update shared.lua to be compatible with lua 5.2"

This reverts commit 20fb27c9591419c958d4362341543fa3ca6b72d8.

breaks compatibility with earlier versions!
calculated static matrix size in matrix.h