From c6110e571159e1b055f75b9e3e2ee5d03cd8530e Mon Sep 17 00:00:00 2001 From: ThePhD Date: Tue, 6 Dec 2016 11:09:13 -0500 Subject: [PATCH] update single --- single/sol/sol.hpp | 65 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index 426f290b..58bb0510 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-12-05 17:03:03.298778 UTC -// This header was generated with sol v2.15.3 (revision 9c2c27f) +// Generated 2016-12-06 15:59:21.255479 UTC +// This header was generated with sol v2.15.4 (revision 16152c7) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -3759,12 +3759,20 @@ namespace sol { stack_reference& operator=(const stack_reference&) noexcept = default; int push() const noexcept { - lua_pushvalue(L, index); + return push(lua_state()); + } + + int push(lua_State* Ls) const noexcept { + lua_pushvalue(Ls, index); return 1; } - void pop(int n = 1) const noexcept { - lua_pop(lua_state(), n); + void pop() const noexcept { + pop(lua_state()); + } + + void pop(lua_State* Ls, int n = 1) const noexcept { + lua_pop(Ls, n); } int stack_index() const noexcept { @@ -3906,12 +3914,20 @@ namespace sol { } int push() const noexcept { - lua_rawgeti(lua_state(), LUA_REGISTRYINDEX, ref); + return push(lua_state()); + } + + int push(lua_State* Ls) const noexcept { + lua_rawgeti(Ls, LUA_REGISTRYINDEX, ref); return 1; } - void pop(int n = 1) const noexcept { - lua_pop(lua_state(), n); + void pop() const noexcept { + pop(lua_state()); + } + + void pop(lua_State* Ls, int n = 1) const noexcept { + lua_pop(Ls, n); } int registry_index() const noexcept { @@ -6089,12 +6105,12 @@ namespace sol { template struct pusher::value || std::is_base_of::value>> { - static int push(lua_State*, const T& ref) { - return ref.push(); + static int push(lua_State* L, const T& ref) { + return ref.push(L); } - static int push(lua_State*, T&& ref) { - return ref.push(); + static int push(lua_State* L, T&& ref) { + return ref.push(L); } }; @@ -9322,7 +9338,11 @@ namespace sol { } int push() const { - lua_pushvalue(L, index); + return push(L); + } + + int push(lua_State* Ls) const { + lua_pushvalue(Ls, index); return 1; } @@ -9876,9 +9896,9 @@ namespace sol { namespace stack { template struct pusher> { - static int push(lua_State*, const proxy& p) { + static int push(lua_State* L, const proxy& p) { sol::reference r = p; - return r.push(); + return r.push(L); } }; } // stack @@ -12242,6 +12262,13 @@ namespace sol { count }; + inline std::size_t total_memory_used(lua_State* L) { + std::size_t kb = lua_gc(L, LUA_GCCOUNT, 0); + kb *= 1024; + kb += lua_gc(L, LUA_GCCOUNTB, 0); + return kb; + } + class state_view { private: lua_State* L; @@ -12488,6 +12515,14 @@ namespace sol { return reg; } + std::size_t memory_used() const { + return total_memory_used(lua_state()); + } + + void collect_garbage() { + lua_gc(lua_state(), LUA_GCCOLLECT, 0); + } + operator lua_State* () const { return lua_state(); }