diff --git a/.gitignore b/.gitignore index 7d7e7db8..bfad8f2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,115 +1,115 @@ -# # # # sol2 -# The MIT License (MIT) -# -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of -# this software and associated documentation files (the "Software"), to deal in -# the Software without restriction, including without limitation the rights to -# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -# the Software, and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# 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. - -# Python (Bytecode) -*.pyc - -# ninja files -*.ninja - -# Visual Studio -*.props -*.user -.vs/ -Debug/ -Release/ -x64/ -x86/ -*.pyproj -*.vcxproj -*.vcxproj.filters -*.tlog -*.lastbuildstate -*.idb -*.sln -*.gitattributes - -# VSCode -.vscode/ - -# CMake -build/ -build-sol2/ -CMakeCache.txt -CMakeFiles/ - -# Compiler outputs -obj/* -bin/* -main.exe -main.o -lua53.dll -lua-5.3.4.dll -main.ilk -main.pdb - -# Dropbox interference -.dropbox* - -# QtCreator -*.creator.user.* -*.config -*.creator -*.files -*.includes - -# Scratchpad Files -m.lua -main.lua -catch_mock.hpp -main_aux.cpp -main.hpp -main2.cpp -main.cpp - -# Local Lua Testbeds -lua-5.3.4-cxx/ -lua-5.3.4/ -lua-5.3.2/ -lua-5.3.1/ -lua-5.3.0/ -lua-5.2.4/ -lua-5.2.2/ -lua-5.2.3/ -lua-5.1.5/ -LuaJIT-2.1.0/ -luajit-2.0.5/ -luajit-2.0.3/ -include/ -liblua.a -lib/liblua5.2.a - -# Docs Artefacts -docs/build/ - -# Sublime Text -*.sublime-workspace -*.sublime-project - - -# Windows Crap -desktop.ini -*.db - -# Miscellaneous -external/ -scratch/ +# # # # sol2 +# The MIT License (MIT) +# +# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +# the Software, and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# 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. + +# Python (Bytecode) +*.pyc + +# ninja files +*.ninja + +# Visual Studio +*.props +*.user +.vs/ +Debug/ +Release/ +x64/ +x86/ +*.pyproj +*.vcxproj +*.vcxproj.filters +*.tlog +*.lastbuildstate +*.idb +*.sln +*.gitattributes + +# VSCode +.vscode/ + +# CMake +build/ +build-sol2/ +CMakeCache.txt +CMakeFiles/ + +# Compiler outputs +obj/* +bin/* +main.exe +main.o +lua53.dll +lua-5.3.4.dll +main.ilk +main.pdb + +# Dropbox interference +.dropbox* + +# QtCreator +*.creator.user.* +*.config +*.creator +*.files +*.includes + +# Scratchpad Files +m.lua +main.lua +catch_mock.hpp +main_aux.cpp +main.hpp +main2.cpp +main.cpp + +# Local Lua Testbeds +lua-5.3.4-cxx/ +lua-5.3.4/ +lua-5.3.2/ +lua-5.3.1/ +lua-5.3.0/ +lua-5.2.4/ +lua-5.2.2/ +lua-5.2.3/ +lua-5.1.5/ +LuaJIT-2.1.0/ +luajit-2.0.5/ +luajit-2.0.3/ +include/ +liblua.a +lib/liblua5.2.a + +# Docs Artefacts +docs/build/ + +# Sublime Text +*.sublime-workspace +*.sublime-project + + +# Windows Crap +desktop.ini +*.db + +# Miscellaneous +external/ +scratch/ diff --git a/cmake/Modules/FindLuaBuild.cmake b/cmake/Modules/FindLuaBuild.cmake index df7c4720..14b24819 100644 --- a/cmake/Modules/FindLuaBuild.cmake +++ b/cmake/Modules/FindLuaBuild.cmake @@ -1,112 +1,120 @@ -# # # # sol2 -# The MIT License (MIT) -# -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of -# this software and associated documentation files (the "Software"), to deal in -# the Software without restriction, including without limitation the rights to -# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -# the Software, and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# 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. - -# # Standard CMake Libraries -include(FindPackageHandleStandardArgs) - -# Contain literally everything inside of this function to prevent spillage -function(find_lua_build LUA_VERSION) - # # # Variables - # # Core Paths - string(TOLOWER ${LUA_VERSION} LUA_BUILD_NORMALIZED_LUA_VERSION) - if (LUA_BUILD_NORMALIZED_LUA_VERSION MATCHES "luajit") - set(LUA_BUILD_LIBNAME ${LUA_VERSION}) - elseif (BUILD_LUAJIT) - set(LUA_BUILD_LIBNAME luajit-${LUA_VERSION}) - elseif (LUA_BUILD_NORMALIZED_LUA_VERSION MATCHES "lua") - set(LUA_BUILD_LIBNAME ${LUA_VERSION}) - elseif (BUILD_LUA) - set(LUA_BUILD_LIBNAME lua-${LUA_VERSION}) - else() - set(LUA_BUILD_LIBNAME lua-${LUA_VERSION}) - endif() - set(LUA_BUILD_TOPLEVEL "${CMAKE_BINARY_DIR}/vendor/${LUA_BUILD_LIBNAME}") - set(LUA_BUILD_INSTALL_DIR "${LUA_BUILD_TOPLEVEL}") - # # Misc needed variables - set(LUA_BUILD_LIBRARY_DESCRIPTION "The base name of the library to build either the static or the dynamic library") - - # Object file suffixes - if (MSVC) - set(LUA_BUILD_BUILD_DLL_DEFAULT ON) - set(LUA_BUILD_OBJECT_FILE_SUFFIX .obj) - else() - set(LUA_BUILD_BUILD_DLL_DEFAULT OFF) - set(LUA_BUILD_OBJECT_FILE_SUFFIX .o) - endif() - - - # # # Options - option(BUILD_LUA_AS_DLL ${LUA_BUILD_BUILD_DLL_DEFAULT} "Build Lua or LuaJIT as a Shared/Dynamic Link Library") - - STRING(TOLOWER ${LUA_BUILD_LIBNAME} LUA_BUILD_NORMALIZED_LIBNAME) - if (NOT LUA_LIBRARY_NAME) - if (LUA_BUILD_NORMALIZED_LIBNAME MATCHES "luajit") - set(LUA_LIBRARY luajit) - else() - set(LUA_LIBRARY ${LUA_BUILD_LIBNAME}) - endif() - else() - set(LUA_LIBRARY_NAME ${LUA_LIBRARY_NAME} - CACHE STRING - ${LUA_BUILD_LIBRARY_DESCRIPTION}) - endif() - # # Dependent Variables - # If we're building a DLL, then set the library type to SHARED - if (BUILD_LUA_AS_DLL) - set(LUA_BUILD_LIBRARY_TYPE SHARED) - else() - set(LUA_BUILD_LIBRARY_TYPE STATIC) - endif() - - - # # # Build Lua - # # Select either LuaJIT or Vanilla Lua here, based on what we discover - if (BUILD_LUAJIT OR LUA_BUILD_NORMALIZED_LUA_VERSION MATCHES "luajit") - include(${CMAKE_CURRENT_LIST_DIR}/FindLuaBuild/LuaJIT.cmake) - set(LUA_VERSION_STRING ${LUA_JIT_VERSION}) - else() - include(${CMAKE_CURRENT_LIST_DIR}/FindLuaBuild/LuaVanilla.cmake) - set(LUA_VERSION_STRING ${LUA_VANILLA_VERSION}) - endif() - - # # Export variables to the parent scope - set(LUA_LIBRARIES ${LUA_LIBRARIES} PARENT_SCOPE) - set(LUA_INTERPRETER ${LUA_INTERPRETER} PARENT_SCOPE) - set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE) - set(LUABUILD_FOUND TRUE PARENT_SCOPE) -endfunction(find_lua_build) - -# Call and then immediately undefine to avoid polluting the global scope -if (LuaBuild_FIND_COMPONENTS) - list(GET LuaBuild_FIND_COMPONENTS 0 LUA_VERSION) -else() - set(LUA_VERSION 5.3.4) -endif() -find_lua_build(${LUA_VERSION}) -unset(find_lua_build) - -# handle the QUIETLY and REQUIRED arguments and set LUABUILD_FOUND to TRUE if -# all listed variables are TRUE -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaBuild - FOUND_VAR LUABUILD_FOUND - REQUIRED_VARS LUA_LIBRARIES LUA_INTERPRETER - VERSION_VAR LUA_VERSION_STRING) +# # # # sol2 +# The MIT License (MIT) +# +# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +# the Software, and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# 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. + +# # Standard CMake Libraries +include(FindPackageHandleStandardArgs) + +# Contain literally everything inside of this function to prevent spillage +function(find_lua_build LUA_VERSION) + # # # Variables + # # Core Paths + string(TOLOWER ${LUA_VERSION} LUA_BUILD_NORMALIZED_LUA_VERSION) + if (LUA_BUILD_NORMALIZED_LUA_VERSION MATCHES "luajit") + set(LUA_BUILD_LIBNAME ${LUA_VERSION}) + elseif (BUILD_LUAJIT) + set(LUA_BUILD_LIBNAME luajit-${LUA_VERSION}) + elseif (LUA_BUILD_NORMALIZED_LUA_VERSION MATCHES "lua") + set(LUA_BUILD_LIBNAME ${LUA_VERSION}) + elseif (BUILD_LUA) + set(LUA_BUILD_LIBNAME lua-${LUA_VERSION}) + else() + set(LUA_BUILD_LIBNAME lua-${LUA_VERSION}) + endif() + set(LUA_BUILD_TOPLEVEL "${CMAKE_BINARY_DIR}/vendor/${LUA_BUILD_LIBNAME}") + set(LUA_BUILD_INSTALL_DIR "${LUA_BUILD_TOPLEVEL}") + # # Misc needed variables + set(LUA_BUILD_LIBRARY_DESCRIPTION "The base name of the library to build either the static or the dynamic library") + + # Object file suffixes + if (MSVC) + set(LUA_BUILD_BUILD_DLL_DEFAULT ON) + set(LUA_BUILD_OBJECT_FILE_SUFFIX .obj) + else() + set(LUA_BUILD_BUILD_DLL_DEFAULT OFF) + set(LUA_BUILD_OBJECT_FILE_SUFFIX .o) + endif() + + + # # # Options + option(BUILD_LUA_AS_DLL ${LUA_BUILD_BUILD_DLL_DEFAULT} "Build Lua or LuaJIT as a Shared/Dynamic Link Library") + + STRING(TOLOWER ${LUA_BUILD_LIBNAME} LUA_BUILD_NORMALIZED_LIBNAME) + if (NOT LUA_LIBRARY_NAME) + if (LUA_BUILD_NORMALIZED_LIBNAME MATCHES "luajit") + set(LUA_LIBRARY luajit) + else() + set(LUA_LIBRARY ${LUA_BUILD_LIBNAME}) + endif() + else() + set(LUA_LIBRARY_NAME ${LUA_LIBRARY_NAME} + CACHE STRING + ${LUA_BUILD_LIBRARY_DESCRIPTION}) + endif() + # # Dependent Variables + # If we're building a DLL, then set the library type to SHARED + if (BUILD_LUA_AS_DLL) + set(LUA_BUILD_LIBRARY_TYPE SHARED) + else() + set(LUA_BUILD_LIBRARY_TYPE STATIC) + endif() + + + # # # Build Lua + # # Select either LuaJIT or Vanilla Lua here, based on what we discover + if (BUILD_LUAJIT OR LUA_BUILD_NORMALIZED_LUA_VERSION MATCHES "luajit") + include(${CMAKE_CURRENT_LIST_DIR}/FindLuaBuild/LuaJIT.cmake) + set(LUA_VERSION_STRING ${LUA_JIT_VERSION}) + else() + include(${CMAKE_CURRENT_LIST_DIR}/FindLuaBuild/LuaVanilla.cmake) + set(LUA_VERSION_STRING ${LUA_VANILLA_VERSION}) + endif() + + # # Export variables to the parent scope + set(LUA_LIBRARIES ${LUA_LIBRARIES} PARENT_SCOPE) + set(LUA_INTERPRETER ${LUA_INTERPRETER} PARENT_SCOPE) + set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE) + set(LUABUILD_FOUND TRUE PARENT_SCOPE) +endfunction(find_lua_build) + +# Call and then immediately undefine to avoid polluting the global scope +if (LuaBuild_FIND_COMPONENTS) + list(GET LuaBuild_FIND_COMPONENTS 0 LUA_VERSION) +endif() +if (LuaBuild_VERSION) + if (LUA_VERSION) + set(LUA_VERSION "${LUA_VERSION}-${LuaBuild_VERSION}") + else() + set(LUA_VERSION "${LuaBuild_VERSION}") + endif() +endif() +if (NOT LUA_VERSION) + set(LUA_VERSION 5.3.4) +endif() +find_lua_build(${LUA_VERSION}) +unset(find_lua_build) + +# handle the QUIETLY and REQUIRED arguments and set LUABUILD_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaBuild + FOUND_VAR LUABUILD_FOUND + REQUIRED_VARS LUA_LIBRARIES LUA_INTERPRETER + VERSION_VAR LUA_VERSION_STRING) diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index b69c26b0..5dbdcc88 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.hpp @@ -1,20255 +1,20256 @@ -// The MIT License (MIT) - -// Copyright (c) 2013-2017 Rapptz, ThePhD and contributors - -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -// the Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -// 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. - -// This file was generated with a script. -// Generated 2018-01-24 00:50:30.722404 UTC -// This header was generated with sol v2.19.0 (revision db9c5d6) -// https://github.com/ThePhD/sol2 - -#ifndef SOL_SINGLE_INCLUDE_HPP -#define SOL_SINGLE_INCLUDE_HPP - -// beginning of sol.hpp - -#ifndef SOL_HPP -#define SOL_HPP - -#if defined(UE_BUILD_DEBUG) || defined(UE_BUILD_DEVELOPMENT) || defined(UE_BUILD_TEST) || defined(UE_BUILD_SHIPPING) || defined(UE_SERVER) -#define SOL_INSIDE_UNREAL -#endif // Unreal Engine 4 bullshit - -#ifdef SOL_INSIDE_UNREAL -#ifdef check -#define SOL_INSIDE_UNREAL_REMOVED_CHECK -#undef check -#endif -#endif // Unreal Engine 4 Bullshit - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wshadow" -#pragma GCC diagnostic ignored "-Wconversion" -#if __GNUC__ > 6 -#pragma GCC diagnostic ignored "-Wnoexcept-type" -#endif -#elif defined __clang__ -#elif defined _MSC_VER -#pragma warning( push ) -#pragma warning( disable : 4324 ) // structure was padded due to alignment specifier -#pragma warning( disable : 4503 ) // decorated name horse shit -#pragma warning( disable : 4702 ) // unreachable code -#pragma warning( disable: 4127 ) // 'conditional expression is constant' yeah that's the point your old compilers don't have `if constexpr` you jerk -#pragma warning( disable: 4505 ) // some other nonsense warning -#endif // clang++ vs. g++ vs. VC++ - -// beginning of sol/forward.hpp - -// beginning of sol/feature_test.hpp - -#if (defined(__cplusplus) && __cplusplus == 201703L) || (defined(_MSC_VER) && _MSC_VER > 1900 && ((defined(_HAS_CXX17) && _HAS_CXX17 == 1) || (defined(_MSVC_LANG) && (_MSVC_LANG > 201402L)))) -#ifndef SOL_CXX17_FEATURES -#define SOL_CXX17_FEATURES 1 -#endif // C++17 features macro -#endif // C++17 features check - -#ifdef SOL_CXX17_FEATURES -#if defined(__cpp_noexcept_function_type) || ((defined(_MSC_VER) && _MSC_VER > 1911) && (defined(_MSVC_LANG) && ((_MSVC_LANG >= 201703L) && defined(_WIN64)))) -#ifndef SOL_NOEXCEPT_FUNCTION_TYPE -#define SOL_NOEXCEPT_FUNCTION_TYPE 1 -#endif // noexcept is part of a function's type -#endif // compiler-specific checks -#endif // C++17 only - -#if defined(_WIN32) || defined(_MSC_VER) -#ifndef SOL_CODECVT_SUPPORT -#define SOL_CODECVT_SUPPORT 1 -#endif // sol codecvt support -#elif defined(__GNUC__) -#if __GNUC__ >= 5 -#ifndef SOL_CODECVT_SUPPORT -#define SOL_CODECVT_SUPPORT 1 -#endif // codecvt support -#endif // g++ 5.x.x (MinGW too) -#else -#endif // Windows/VC++ vs. g++ vs Others - -#ifdef _MSC_VER -#if defined(_DEBUG) && !defined(NDEBUG) - -#ifndef SOL_IN_DEBUG_DETECTED -#define SOL_IN_DEBUG_DETECTED 1 -#endif - -#endif // VC++ Debug macros - -#ifndef _CPPUNWIND -#ifndef SOL_NO_EXCEPTIONS -#define SOL_NO_EXCEPTIONS 1 -#endif -#endif // Automatic Exceptions - -#ifndef _CPPRTTI -#ifndef SOL_NO_RTTI -#define SOL_NO_RTTI 1 -#endif -#endif // Automatic RTTI -#elif defined(__GNUC__) || defined(__clang__) - -#if !defined(NDEBUG) && !defined(__OPTIMIZE__) - -#ifndef SOL_IN_DEBUG_DETECTED -#define SOL_IN_DEBUG_DETECTED 1 -#endif - -#endif // Not Debug && g++ optimizer flag - -#ifndef __EXCEPTIONS -#ifndef SOL_NO_EXCEPTIONS -#define SOL_NO_EXCEPTIONS 1 -#endif -#endif // No Exceptions - -#ifndef __GXX_RTTI -#ifndef SOL_NO_RTII -#define SOL_NO_RTTI 1 -#endif -#endif // No RTTI - -#endif // vc++ || clang++/g++ - -#if defined(SOL_CHECK_ARGUMENTS) - -#if !defined(SOL_SAFE_GETTER) -#define SOL_SAFE_GETTER 1 -#endif - -#if !defined(SOL_SAFE_USERTYPE) -#define SOL_SAFE_USERTYPE 1 -#endif - -#if !defined(SOL_SAFE_REFERENCES) -#define SOL_SAFE_REFERENCES 1 -#endif - -#if !defined(SOL_SAFE_FUNCTION) -#define SOL_SAFE_FUNCTION 1 -#endif - -#if !defined(SOL_SAFE_FUNCTION_CALLS) -#define SOL_SAFE_FUNCTION_CALLS 1 -#endif - -#if !defined(SOL_SAFE_PROXIES) -#define SOL_SAFE_PROXIES 1 -#endif - -#if !defined(SOL_SAFE_NUMERICS) -#define SOL_SAFE_NUMERICS 1 -#endif - -#endif // Turn on Safety for all if top-level macro is defined - -#ifdef SOL_IN_DEBUG_DETECTED - -#if !defined(SOL_SAFE_REFERENCES) -#define SOL_SAFE_REFERENCES 1 -#endif - -#if !defined(SOL_SAFE_USERTYPE) -#define SOL_SAFE_USERTYPE 1 -#endif - -#if !defined(SOL_SAFE_FUNCTION_CALLS) -#define SOL_SAFE_FUNCTION_CALLS 1 -#endif - -#endif // Turn on all debug safety features for VC++ / g++ / clang++ and similar - -#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) || defined(__OBJC__) || defined(nil) -#if !defined(SOL_NO_NIL) -#define SOL_NO_NIL 1 -#endif -#endif // avoiding nil defines / keywords - -// end of sol/feature_test.hpp - -namespace sol { - - template - class basic_reference; - using reference = basic_reference; - using main_reference = basic_reference; - class stack_reference; - - struct proxy_base_tag; - template - struct proxy_base; - template - struct proxy; - - template - class usertype; - template - class simple_usertype; - template - class basic_table_core; - template - using table_core = basic_table_core; - template - using main_table_core = basic_table_core; - template - using stack_table_core = basic_table_core; - template - using basic_table = basic_table_core; - typedef table_core table; - typedef table_core global_table; - typedef main_table_core main_table; - typedef main_table_core main_global_table; - typedef stack_table_core stack_table; - typedef stack_table_core stack_global_table; - template - struct basic_environment; - using environment = basic_environment; - using main_environment = basic_environment; - using stack_environment = basic_environment; - template - class basic_function; - template - class basic_protected_function; - using unsafe_function = basic_function; - using safe_function = basic_protected_function; - using main_unsafe_function = basic_function; - using main_safe_function = basic_protected_function; - using stack_unsafe_function = basic_function; - using stack_safe_function = basic_protected_function; - using stack_aligned_unsafe_function = basic_function; - using stack_aligned_safe_function = basic_protected_function; - using protected_function = safe_function; - using main_protected_function = main_safe_function; - using stack_protected_function = stack_safe_function; - using stack_aligned_protected_function = stack_aligned_safe_function; -#ifdef SOL_SAFE_FUNCTION - using function = protected_function; - using main_function = main_protected_function; - using stack_function = stack_protected_function; -#else - using function = unsafe_function; - using main_function = main_unsafe_function; - using stack_function = stack_unsafe_function; -#endif - using stack_aligned_function = stack_aligned_unsafe_function; - using stack_aligned_stack_handler_function = basic_protected_function; - - struct unsafe_function_result; - struct protected_function_result; - using safe_function_result = protected_function_result; -#ifdef SOL_SAFE_FUNCTION - using function_result = safe_function_result; -#else - using function_result = unsafe_function_result; -#endif - - template - class basic_object; - template - class basic_userdata; - template - class basic_lightuserdata; - template - class basic_coroutine; - template - class basic_thread; - - using object = basic_object; - using userdata = basic_userdata; - using lightuserdata = basic_lightuserdata; - using thread = basic_thread; - using coroutine = basic_coroutine; - using main_object = basic_object; - using main_userdata = basic_userdata; - using main_lightuserdata = basic_lightuserdata; - using main_coroutine = basic_coroutine; - using stack_object = basic_object; - using stack_userdata = basic_userdata; - using stack_lightuserdata = basic_lightuserdata; - using stack_thread = basic_thread; - using stack_coroutine = basic_coroutine; - - struct stack_proxy_base; - struct stack_proxy; - struct variadic_args; - struct variadic_results; - struct stack_count; - struct this_state; - struct this_main_state; - struct this_environment; - - template - struct as_table_t; - template - struct as_container_t; - template - struct nested; - template - struct light; - template - struct user; - template - struct as_args_t; - template - struct protect_t; - template - struct filter_wrapper; -} // namespace sol - -// end of sol/forward.hpp - -// beginning of sol/state.hpp - -// beginning of sol/state_view.hpp - -// beginning of sol/error.hpp - -#include -#include - -namespace sol { - namespace detail { - struct direct_error_tag {}; - const auto direct_error = direct_error_tag{}; - } // namespace detail - - class error : public std::runtime_error { - private: - // Because VC++ is a fuccboi - std::string w; - - public: - error(const std::string& str) - : error(detail::direct_error, "lua: error: " + str) { - } - error(std::string&& str) - : error(detail::direct_error, "lua: error: " + std::move(str)) { - } - error(detail::direct_error_tag, const std::string& str) - : std::runtime_error(""), w(str) { - } - error(detail::direct_error_tag, std::string&& str) - : std::runtime_error(""), w(std::move(str)) { - } - - error(const error& e) = default; - error(error&& e) = default; - error& operator=(const error& e) = default; - error& operator=(error&& e) = default; - - virtual const char* what() const noexcept override { - return w.c_str(); - } - }; - -} // namespace sol - -// end of sol/error.hpp - -// beginning of sol/table.hpp - -// beginning of sol/table_core.hpp - -// beginning of sol/proxy.hpp - -// beginning of sol/traits.hpp - -// beginning of sol/tuple.hpp - -#include -#include - -namespace sol { - namespace detail { - using swallow = std::initializer_list; - } // namespace detail - - template - struct types { - typedef std::make_index_sequence indices; - static constexpr std::size_t size() { - return sizeof...(Args); - } - }; - namespace meta { - namespace detail { - template - struct tuple_types_ { typedef types type; }; - - template - struct tuple_types_> { typedef types type; }; - } // namespace detail - - template - using unqualified = std::remove_cv>; - - template - using unqualified_t = typename unqualified::type; - - template - using tuple_types = typename detail::tuple_types_::type; - - template - struct pop_front_type; - - template - using pop_front_type_t = typename pop_front_type::type; - - template - struct pop_front_type> { - typedef void front_type; - typedef types type; - }; - - template - struct pop_front_type> { - typedef Arg front_type; - typedef types type; - }; - - template - using tuple_element = std::tuple_element>; - - template - using tuple_element_t = std::tuple_element_t>; - - template - using unqualified_tuple_element = unqualified>; - - template - using unqualified_tuple_element_t = unqualified_t>; - - } // namespace meta -} // namespace sol - -// end of sol/tuple.hpp - -// beginning of sol/bind_traits.hpp - -namespace sol { -namespace meta { - namespace meta_detail { - - template - struct check_deducible_signature { - struct nat {}; - template - static auto test(int) -> decltype(&G::operator(), void()); - template - static auto test(...) -> nat; - - using type = std::is_void(0))>; - }; - } // namespace meta_detail - - template - struct has_deducible_signature : meta_detail::check_deducible_signature::type {}; - - namespace meta_detail { - - template - struct void_tuple_element : meta::tuple_element {}; - - template - struct void_tuple_element> { typedef void type; }; - - template - using void_tuple_element_t = typename void_tuple_element::type; - - template - struct basic_traits { - private: - typedef std::conditional_t::value, int, T>& first_type; - - public: - static const bool is_noexcept = it_is_noexcept; - static const bool is_member_function = std::is_void::value; - static const bool has_c_var_arg = has_c_variadic; - static const std::size_t arity = sizeof...(Args); - static const std::size_t free_arity = sizeof...(Args) + static_cast(!std::is_void::value); - typedef types args_list; - typedef std::tuple args_tuple; - typedef T object_type; - typedef R return_type; - typedef tuple_types returns_list; - typedef R(function_type)(Args...); - typedef std::conditional_t::value, args_list, types> free_args_list; - typedef std::conditional_t::value, R(Args...), R(first_type, Args...)> free_function_type; - typedef std::conditional_t::value, R (*)(Args...), R (*)(first_type, Args...)> free_function_pointer_type; - typedef std::remove_pointer_t signature_type; - template - using arg_at = void_tuple_element_t; - }; - - template ::value> - struct fx_traits : basic_traits {}; - - // Free Functions - template - struct fx_traits : basic_traits { - typedef R (*function_pointer_type)(Args...); - }; - - template - struct fx_traits : basic_traits { - typedef R (*function_pointer_type)(Args...); - }; - - template - struct fx_traits : basic_traits { - typedef R (*function_pointer_type)(Args..., ...); - }; - - template - struct fx_traits : basic_traits { - typedef R (*function_pointer_type)(Args..., ...); - }; - - // Member Functions - /* C-Style Variadics */ - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...); - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...); - }; - - /* Const Volatile */ - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) const; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) const; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) const volatile; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) const volatile; - }; - - /* Member Function Qualifiers */ - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) &; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) &; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) const&; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) const&; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) const volatile&; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) const volatile&; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) &&; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) &&; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) const&&; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) const&&; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) const volatile&&; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) const volatile&&; - }; - -#ifdef SOL_NOEXCEPT_FUNCTION_TYPE - - template - struct fx_traits : basic_traits { - typedef R (*function_pointer_type)(Args...) noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (*function_pointer_type)(Args...) noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (*function_pointer_type)(Args..., ...) noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (*function_pointer_type)(Args..., ...) noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) noexcept; - }; - - /* Const Volatile */ - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) const noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) const noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) const volatile noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) const volatile noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) & noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) & noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) const& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) const& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) const volatile& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) const volatile& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) && noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) && noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) const&& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) const&& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args...) const volatile&& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (T::*function_pointer_type)(Args..., ...) const volatile&& noexcept; - }; - -#endif // noexcept is part of a function's type - -#if defined(_MSC_VER) && defined(_M_IX86) - template - struct fx_traits : basic_traits { - typedef R(__stdcall* function_pointer_type)(Args...); - }; - - template - struct fx_traits : basic_traits { - typedef R(__stdcall* function_pointer_type)(Args...); - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...); - }; - - /* Const Volatile */ - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) const; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) const volatile; - }; - - /* Member Function Qualifiers */ - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) &; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) const&; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) const volatile&; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) &&; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) const&&; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) const volatile&&; - }; - -#ifdef SOL_NOEXCEPT_FUNCTION_TYPE - - template - struct fx_traits : basic_traits { - typedef R(__stdcall* function_pointer_type)(Args...) noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R(__stdcall* function_pointer_type)(Args...) noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R(__stdcall* function_pointer_type)(Args..., ...) noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R(__stdcall* function_pointer_type)(Args..., ...) noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args..., ...) noexcept; - }; - - /* Const Volatile */ - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) const noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args..., ...) const noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) const volatile noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args..., ...) const volatile noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) & noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args..., ...) & noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) const& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args..., ...) const& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) const volatile& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args..., ...) const volatile& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) && noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args..., ...) && noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) const&& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args..., ...) const&& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args...) const volatile&& noexcept; - }; - - template - struct fx_traits : basic_traits { - typedef R (__stdcall T::*function_pointer_type)(Args..., ...) const volatile&& noexcept; - }; -#endif // noexcept is part of a function's type -#endif // __stdcall x86 VC++ bug - - template - struct fx_traits : fx_traits::function_type, false> {}; - - template ::value> - struct callable_traits : fx_traits> { - }; - - template - struct callable_traits { - typedef R Arg; - typedef T object_type; - using signature_type = R(T::*); - static const bool is_noexcept = false; - static const bool is_member_function = false; - static const std::size_t arity = 1; - static const std::size_t free_arity = 2; - typedef std::tuple args_tuple; - typedef R return_type; - typedef types args_list; - typedef types free_args_list; - typedef meta::tuple_types returns_list; - typedef R(function_type)(T&, R); - typedef R (*function_pointer_type)(T&, R); - typedef R (*free_function_pointer_type)(T&, R); - template - using arg_at = void_tuple_element_t; - }; - - } // namespace meta_detail - - template - struct bind_traits : meta_detail::callable_traits {}; - - template - using function_args_t = typename bind_traits::args_list; - - template - using function_signature_t = typename bind_traits::signature_type; - - template - using function_return_t = typename bind_traits::return_type; -} -} // namespace sol::meta - -// end of sol/bind_traits.hpp - -#include -#include -#include -#include -#include -#include -#ifdef SOL_CXX17_FEATURES -#include -#endif - -namespace sol { - template - using index_value = std::integral_constant; - - namespace meta { - template - struct identity { typedef T type; }; - - template - using identity_t = typename identity::type; - - template - struct is_tuple : std::false_type {}; - - template - struct is_tuple> : std::true_type {}; - - template - struct is_builtin_type : std::integral_constant::value || std::is_pointer::value || std::is_array::value> {}; - - template - struct unwrapped { - typedef T type; - }; - - template - struct unwrapped> { - typedef T type; - }; - - template - using unwrapped_t = typename unwrapped::type; - - template - struct unwrap_unqualified : unwrapped> {}; - - template - using unwrap_unqualified_t = typename unwrap_unqualified::type; - - template - struct remove_member_pointer; - - template - struct remove_member_pointer { - typedef R type; - }; - - template - struct remove_member_pointer { - typedef R type; - }; - - template - using remove_member_pointer_t = remove_member_pointer; - - template