mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Fix #913
This commit is contained in:
parent
36972a994b
commit
43f215c27d
|
@ -44,8 +44,7 @@
|
|||
#endif // Can use variant
|
||||
#endif // C++17
|
||||
|
||||
namespace sol {
|
||||
namespace stack {
|
||||
namespace sol { namespace stack {
|
||||
namespace stack_detail {
|
||||
template <typename T>
|
||||
inline bool integer_value_fits(const T& value) {
|
||||
|
@ -64,7 +63,7 @@ namespace sol {
|
|||
|
||||
template <typename T>
|
||||
int msvc_is_ass_with_if_constexpr_push_enum(std::true_type, lua_State* L, const T& value) {
|
||||
if constexpr (meta::any_same_v<std::underlying_type_t<T>, char/*, char8_t*/, char16_t, char32_t>) {
|
||||
if constexpr (meta::any_same_v<std::underlying_type_t<T>, char /*, char8_t*/, char16_t, char32_t>) {
|
||||
if constexpr (std::is_signed_v<T>) {
|
||||
return stack::push(L, static_cast<std::int_least32_t>(value));
|
||||
}
|
||||
|
@ -81,7 +80,7 @@ namespace sol {
|
|||
int msvc_is_ass_with_if_constexpr_push_enum(std::false_type, lua_State*, const T&) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} // namespace stack_detail
|
||||
|
||||
inline int push_environment_of(lua_State* L, int index = -1) {
|
||||
#if defined(SOL_SAFE_STACK_CHECK) && SOL_SAFE_STACK_CHECK
|
||||
|
@ -212,9 +211,9 @@ namespace sol {
|
|||
|
||||
template <typename... Args>
|
||||
static int push_deep(lua_State* L, Args&&... args) {
|
||||
#if defined(SOL_SAFE_STACK_CHECK) && SOL_SAFE_STACK_CHECK
|
||||
#if defined(SOL_SAFE_STACK_CHECK) && SOL_SAFE_STACK_CHECK
|
||||
luaL_checkstack(L, 1, detail::not_enough_stack_space_userdata);
|
||||
#endif // make sure stack doesn't overflow
|
||||
#endif // make sure stack doesn't overflow
|
||||
P** pref = nullptr;
|
||||
detail::unique_destructor* fx = nullptr;
|
||||
detail::unique_tag* id = nullptr;
|
||||
|
@ -270,7 +269,7 @@ namespace sol {
|
|||
#if defined(SOL_NO_EXCEPTIONS) && SOL_NO_EXCEPTIONS
|
||||
// Is this really worth it?
|
||||
assert(false && "integer value will be misrepresented in lua");
|
||||
lua_pushnumber(L, static_cast<lua_Number>(std::forward<Args>(args)...));
|
||||
lua_pushinteger(L, static_cast<lua_Integer>(value));
|
||||
return 1;
|
||||
#else
|
||||
throw error(detail::direct_error, "integer value will be misrepresented in lua");
|
||||
|
@ -1153,7 +1152,8 @@ namespace sol {
|
|||
const auto bcsize = bc.size();
|
||||
// pushes either the function, or an error
|
||||
// if it errors, shit goes south, and people can test that upstream
|
||||
(void)luaL_loadbuffer(L, reinterpret_cast<const char*>(first), static_cast<std::size_t>(bcsize * (sizeof(*first) / sizeof(const char))), bytecode_name);
|
||||
(void)luaL_loadbuffer(
|
||||
L, reinterpret_cast<const char*>(first), static_cast<std::size_t>(bcsize * (sizeof(*first) / sizeof(const char))), bytecode_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1204,7 +1204,6 @@ namespace sol {
|
|||
};
|
||||
#endif // Variant because Clang is terrible
|
||||
#endif // C++17 Support
|
||||
}
|
||||
} // namespace sol::stack
|
||||
}} // namespace sol::stack
|
||||
|
||||
#endif // SOL_STACK_PUSH_HPP
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// This file was generated with a script.
|
||||
// Generated 2019-12-23 14:09:10.625316 UTC
|
||||
// This header was generated with sol v3.2.0 (revision 1f27149)
|
||||
// Generated 2019-12-25 18:24:10.892183 UTC
|
||||
// This header was generated with sol v3.2.0 (revision 36972a9)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// This file was generated with a script.
|
||||
// Generated 2019-12-23 14:09:10.057090 UTC
|
||||
// This header was generated with sol v3.2.0 (revision 1f27149)
|
||||
// Generated 2019-12-25 18:24:10.331683 UTC
|
||||
// This header was generated with sol v3.2.0 (revision 36972a9)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||
|
@ -13085,8 +13085,7 @@ namespace sol { namespace stack {
|
|||
#endif // Can use variant
|
||||
#endif // C++17
|
||||
|
||||
namespace sol {
|
||||
namespace stack {
|
||||
namespace sol { namespace stack {
|
||||
namespace stack_detail {
|
||||
template <typename T>
|
||||
inline bool integer_value_fits(const T& value) {
|
||||
|
@ -13105,7 +13104,7 @@ namespace sol {
|
|||
|
||||
template <typename T>
|
||||
int msvc_is_ass_with_if_constexpr_push_enum(std::true_type, lua_State* L, const T& value) {
|
||||
if constexpr (meta::any_same_v<std::underlying_type_t<T>, char/*, char8_t*/, char16_t, char32_t>) {
|
||||
if constexpr (meta::any_same_v<std::underlying_type_t<T>, char /*, char8_t*/, char16_t, char32_t>) {
|
||||
if constexpr (std::is_signed_v<T>) {
|
||||
return stack::push(L, static_cast<std::int_least32_t>(value));
|
||||
}
|
||||
|
@ -13122,7 +13121,7 @@ namespace sol {
|
|||
int msvc_is_ass_with_if_constexpr_push_enum(std::false_type, lua_State*, const T&) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} // namespace stack_detail
|
||||
|
||||
inline int push_environment_of(lua_State* L, int index = -1) {
|
||||
#if defined(SOL_SAFE_STACK_CHECK) && SOL_SAFE_STACK_CHECK
|
||||
|
@ -13253,9 +13252,9 @@ namespace sol {
|
|||
|
||||
template <typename... Args>
|
||||
static int push_deep(lua_State* L, Args&&... args) {
|
||||
#if defined(SOL_SAFE_STACK_CHECK) && SOL_SAFE_STACK_CHECK
|
||||
#if defined(SOL_SAFE_STACK_CHECK) && SOL_SAFE_STACK_CHECK
|
||||
luaL_checkstack(L, 1, detail::not_enough_stack_space_userdata);
|
||||
#endif // make sure stack doesn't overflow
|
||||
#endif // make sure stack doesn't overflow
|
||||
P** pref = nullptr;
|
||||
detail::unique_destructor* fx = nullptr;
|
||||
detail::unique_tag* id = nullptr;
|
||||
|
@ -13311,7 +13310,7 @@ namespace sol {
|
|||
#if defined(SOL_NO_EXCEPTIONS) && SOL_NO_EXCEPTIONS
|
||||
// Is this really worth it?
|
||||
assert(false && "integer value will be misrepresented in lua");
|
||||
lua_pushnumber(L, static_cast<lua_Number>(std::forward<Args>(args)...));
|
||||
lua_pushinteger(L, static_cast<lua_Integer>(value));
|
||||
return 1;
|
||||
#else
|
||||
throw error(detail::direct_error, "integer value will be misrepresented in lua");
|
||||
|
@ -14194,7 +14193,8 @@ namespace sol {
|
|||
const auto bcsize = bc.size();
|
||||
// pushes either the function, or an error
|
||||
// if it errors, shit goes south, and people can test that upstream
|
||||
(void)luaL_loadbuffer(L, reinterpret_cast<const char*>(first), static_cast<std::size_t>(bcsize * (sizeof(*first) / sizeof(const char))), bytecode_name);
|
||||
(void)luaL_loadbuffer(
|
||||
L, reinterpret_cast<const char*>(first), static_cast<std::size_t>(bcsize * (sizeof(*first) / sizeof(const char))), bytecode_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -14245,8 +14245,7 @@ namespace sol {
|
|||
};
|
||||
#endif // Variant because Clang is terrible
|
||||
#endif // C++17 Support
|
||||
}
|
||||
} // namespace sol::stack
|
||||
}} // namespace sol::stack
|
||||
|
||||
// end of sol/stack_push.hpp
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user