Added class function from lua-users wiki