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

@ -26,4 +26,4 @@
#include "sol/object.hpp"
#include "sol/function.hpp"
#endif // SOL_HPP
#endif // SOL_HPP

View File

@ -68,4 +68,4 @@ std::string demangle(const std::type_info& id) {
} // detail
} // sol
#endif // SOL_DEMANGLE_HPP
#endif // SOL_DEMANGLE_HPP

View File

@ -32,4 +32,4 @@
#endif // compilers
#endif // SOL_DEPRECATED
#endif // SOL_DEPRECATE_HPP
#endif // SOL_DEPRECATE_HPP

View File

@ -32,4 +32,4 @@ public:
};
} // sol
#endif // SOL_ERROR_HPP
#endif // SOL_ERROR_HPP

View File

@ -36,7 +36,7 @@ private:
template<typename... Ret>
std::tuple<Ret...> invoke(types<Ret...>, std::size_t n) {
luacall(n, sizeof...(Ret));
luacall(n, sizeof...(Ret));
return stack::pop_reverse_call(state(), std::make_tuple<Ret...>, types<Ret...>());
}
@ -71,7 +71,7 @@ public:
typename return_type<Ret...>::type operator()(types<Ret...>, Args&&... args) {
return call<Ret...>(std::forward<Args>(args)...);
}
template<typename... Ret, typename... Args>
typename return_type<Ret...>::type call(Args&&... args) {
push();

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&) {
@ -65,4 +69,4 @@ inline bool operator!=(const nil_t&, const object& rhs) {
}
} // sol
#endif // SOL_OBJECT_HPP
#endif // SOL_OBJECT_HPP

View File

@ -126,4 +126,4 @@ inline bool operator!= (const proxy<Table, Key>& right, T&& left) {
return right.template get<Decay<T>>() != left;
}
} // sol
} // sol

View File

@ -92,4 +92,4 @@ public:
};
} // sol
#endif // SOL_REFERENCE_HPP
#endif // SOL_REFERENCE_HPP

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>
@ -351,4 +351,4 @@ struct get_return {
} // stack
} // sol
#endif // SOL_STACK_HPP
#endif // SOL_STACK_HPP

View File

@ -208,4 +208,4 @@ public:
};
} // sol
#endif // SOL_STATE_HPP
#endif // SOL_STATE_HPP

View File

@ -261,4 +261,4 @@ private:
};
} // sol
#endif // SOL_TABLE_HPP
#endif // SOL_TABLE_HPP

View File

@ -147,4 +147,4 @@ struct function_traits<R(*)(Args...)> {
};
} // sol
#endif // SOL_TRAITS_HPP
#endif // SOL_TRAITS_HPP

View File

@ -81,4 +81,4 @@ const auto default_constructor = constructors<types<>>{};
} // sol
#endif // SOL_TUPLE_HPP
#endif // SOL_TUPLE_HPP

View File

@ -160,4 +160,4 @@ inline bool operator==(nil_t, nil_t) { return true; }
inline bool operator!=(nil_t, nil_t) { return false; }
} // sol
#endif // SOL_TYPES_HPP
#endif // SOL_TYPES_HPP