TYPE* luaQ_checkqobject<TYPE>(lua_State *L, int index)

This function causes an error if the Lua value at position index in the stack does not represent a Qt object of class TYPE. Otherwise it returns a pointer to the object.