finished lua 5.2 compatibility