Merge remote-tracking branch 'root/master'

This commit is contained in:
ThePhD 2014-05-29 02:32:16 -04:00
commit a8e9c01d0d
15 changed files with 25 additions and 21 deletions

View File

@ -19,8 +19,8 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef SOL_LUA_FUNC_HPP
#define SOL_LUA_FUNC_HPP
#ifndef SOL_FUNCTION_TYPES_HPP
#define SOL_FUNCTION_TYPES_HPP
#include "stack.hpp"
#include <memory>
@ -283,4 +283,4 @@ struct userdata_function : public base_function {
} // sol
#endif // SOL_LUA_FUNC_HPP
#endif // SOL_FUNCTION_TYPES_HPP

View File

@ -46,6 +46,10 @@ public:
auto actual = lua_type(state(), -1);
return (static_cast<int>(expected) == actual) || (expected == type::poly);
}
explicit operator bool() const {
return is<nil_t>();
}
};
inline bool operator==(const object& lhs, const nil_t&) {

View File

@ -68,9 +68,9 @@ inline T& get(types<userdata<T>>, lua_State* L, int index = -1) {
return *obj;
}
template <typename T>
inline T get(types<T>, lua_State* L, int index = -1) {
return T(L, index);
template <typename T, typename U = typename std::remove_reference<T>::type>
inline U get(types<T>, lua_State* L, int index = -1) {
return U(L, index);
}
template<typename T>