diff --git a/docs/source/safety.rst b/docs/source/safety.rst index 12affb28..79e51e67 100644 --- a/docs/source/safety.rst +++ b/docs/source/safety.rst @@ -84,6 +84,11 @@ Feature Config * Includes ```` and prints all exceptions and errors to ``std::cerr``, for you to see * **Not** turned on by default under any settings: *this MUST be turned on manually* +``SOL_CONTAINERS_START`` triggers the following change: + * If defined and **is an integral value**, is used to adjust the container start value + * Applies to C++ containers **only** (not Lua tables or algorithms) + * Defaults to 1 (containers in Lua count from 1) + ``SOL_ENABLE_INTEROP`` triggers the following change: * Allows the use of ``extensible`` to be used with ``userdata_checker`` and ``userdata_getter`` to retrieve non-sol usertypes - Particularly enables non-sol usertypes to be used in overloads diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index 7a28d353..5abaa9c4 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.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 2018-05-20 19:25:19.981188 UTC -// This header was generated with sol v2.20.1 (revision 4f366a1) +// Generated 2018-05-22 19:42:19.603781 UTC +// This header was generated with sol v2.20.2 (revision d67c5b7) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -16949,7 +16949,11 @@ namespace sol { } static std::ptrdiff_t index_adjustment(lua_State*, T&) { +#if defined(SOL_CONTAINERS_START_INDEX) + return static_cast((SOL_CONTAINERS_START) == 0 ? 0 : -(SOL_CONTAINERS_START)); +#else return static_cast(-1); +#endif } static int pairs(lua_State* L) { diff --git a/single/sol/sol_forward.hpp b/single/sol/sol_forward.hpp index 8cf2b83f..bc55b02c 100644 --- a/single/sol/sol_forward.hpp +++ b/single/sol/sol_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 2018-05-20 19:25:20.251908 UTC -// This header was generated with sol v2.20.1 (revision 4f366a1) +// Generated 2018-05-22 19:42:19.843589 UTC +// This header was generated with sol v2.20.2 (revision d67c5b7) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP diff --git a/sol/container_traits.hpp b/sol/container_traits.hpp index 1d3fc4d3..ee0acf48 100644 --- a/sol/container_traits.hpp +++ b/sol/container_traits.hpp @@ -1273,7 +1273,11 @@ namespace sol { } static std::ptrdiff_t index_adjustment(lua_State*, T&) { +#if defined(SOL_CONTAINERS_START_INDEX) + return static_cast((SOL_CONTAINERS_START) == 0 ? 0 : -(SOL_CONTAINERS_START)); +#else return static_cast(-1); +#endif } static int pairs(lua_State* L) {