From 391f29afb1780312079ccf7ae732d26308c7c41e Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sat, 15 Oct 2016 18:36:30 -0400 Subject: [PATCH] Oh boy, new compatibility files...! --- single/sol/sol.hpp | 29 +++++++++++++++++++++++-- sol/compatibility/5.2.0.h | 43 +++++++++++++++++++++++++++++++++++++ sol/compatibility/5.x.x.inl | 1 + 3 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 sol/compatibility/5.2.0.h diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index faeff5de..817d4af2 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 2016-10-15 21:59:41.897573 UTC -// This header was generated with sol v2.14.10 (revision f3fbd24) +// Generated 2016-10-15 22:36:09.229006 UTC +// This header was generated with sol v2.14.10 (revision ebc8d0f) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -2138,6 +2138,31 @@ int luaL_fileresult(lua_State *L, int stat, const char *fname); #ifndef SOL_5_X_X_INL #define SOL_5_X_X_INL +// beginning of sol/compatibility/5.2.0.h + +#ifndef SOL_5_2_0_H +#define SOL_5_2_0_H + +#if SOL_LUA_VERSION < 503 + +int lua_isinteger(lua_State* L, int idx) { + if (lua_type(L, idx) != LUA_TNUMBER) + return 0; + // This is a very slipshod way to do the testing + // but lua_totingerx doesn't play ball nicely + // on older versions... + lua_Number n = lua_tonumber(L, idx); + lua_Integer i = lua_tointeger(L, idx); + if (i != n) + return 0; + // it's DEFINITELY an integer + return 1; +} + +#endif // SOL_LUA_VERSION == 502 +#endif // SOL_5_2_0_H +// end of sol/compatibility/5.2.0.h + #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM == 501 #include diff --git a/sol/compatibility/5.2.0.h b/sol/compatibility/5.2.0.h new file mode 100644 index 00000000..1f19f2f1 --- /dev/null +++ b/sol/compatibility/5.2.0.h @@ -0,0 +1,43 @@ +// The MIT License (MIT) + +// Copyright (c) 2013-2016 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. + +#ifndef SOL_5_2_0_H +#define SOL_5_2_0_H +#include "version.hpp" + +#if SOL_LUA_VERSION < 503 + +int lua_isinteger(lua_State* L, int idx) { + if (lua_type(L, idx) != LUA_TNUMBER) + return 0; + // This is a very slipshod way to do the testing + // but lua_totingerx doesn't play ball nicely + // on older versions... + lua_Number n = lua_tonumber(L, idx); + lua_Integer i = lua_tointeger(L, idx); + if (i != n) + return 0; + // it's DEFINITELY an integer + return 1; +} + +#endif // SOL_LUA_VERSION == 502 +#endif // SOL_5_2_0_H diff --git a/sol/compatibility/5.x.x.inl b/sol/compatibility/5.x.x.inl index 1d420e3f..17bab23c 100644 --- a/sol/compatibility/5.x.x.inl +++ b/sol/compatibility/5.x.x.inl @@ -23,6 +23,7 @@ #define SOL_5_X_X_INL #include "version.hpp" +#include "5.2.0.h" #include "5.1.0.h" #include "5.0.0.h" #include "5.x.x.h"