mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
don't forget to pop!
This commit is contained in:
parent
a068c4e6e6
commit
72143a494b
|
@ -20,8 +20,8 @@
|
||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// This file was generated with a script.
|
// This file was generated with a script.
|
||||||
// Generated 2017-09-13 15:37:13.293030 UTC
|
// Generated 2017-09-13 15:45:14.036087 UTC
|
||||||
// This header was generated with sol v2.18.3 (revision 7ff3a39)
|
// This header was generated with sol v2.18.3 (revision a068c4e)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||||
|
@ -5916,8 +5916,9 @@ namespace sol {
|
||||||
if (L == nullptr)
|
if (L == nullptr)
|
||||||
return backup_if_unsupported;
|
return backup_if_unsupported;
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_MAINTHREAD);
|
lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_MAINTHREAD);
|
||||||
L = lua_tothread(L, -1);
|
lua_State* Lmain = lua_tothread(L, -1);
|
||||||
return L;
|
lua_pop(L, 1);
|
||||||
|
return Lmain;
|
||||||
#endif // Lua 5.2+ has the main thread getter
|
#endif // Lua 5.2+ has the main thread getter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,8 +141,9 @@ namespace sol {
|
||||||
if (L == nullptr)
|
if (L == nullptr)
|
||||||
return backup_if_unsupported;
|
return backup_if_unsupported;
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_MAINTHREAD);
|
lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_MAINTHREAD);
|
||||||
L = lua_tothread(L, -1);
|
lua_State* Lmain = lua_tothread(L, -1);
|
||||||
return L;
|
lua_pop(L, 1);
|
||||||
|
return Lmain;
|
||||||
#endif // Lua 5.2+ has the main thread getter
|
#endif // Lua 5.2+ has the main thread getter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,4 +31,10 @@ TEST_CASE("storage/main thread", "ensure round-tripping and pulling out thread d
|
||||||
lua_State* ts = sol::main_thread(lua, lua);
|
lua_State* ts = sol::main_thread(lua, lua);
|
||||||
REQUIRE(ts == orig);
|
REQUIRE(ts == orig);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
sol::stack_guard g(lua);
|
||||||
|
lua_State* orig = lua;
|
||||||
|
lua_State* ts = sol::main_thread(lua);
|
||||||
|
REQUIRE(ts == orig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user