tfw you break everything 'cause you're bad

This commit is contained in:
ThePhD 2017-04-09 13:03:41 -04:00
parent 2df532f79b
commit a6e03ac214
3 changed files with 26 additions and 14 deletions

View File

@ -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-04-09 16:04:17.392392 UTC // Generated 2017-04-09 17:03:27.912893 UTC
// This header was generated with sol v2.17.0 (revision 8145622) // This header was generated with sol 2.17.0 (revision 2df532f)
// https://github.com/ThePhD/sol2 // https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP #ifndef SOL_SINGLE_INCLUDE_HPP
@ -13093,8 +13093,8 @@ namespace sol {
if (x != load_status::ok) { if (x != load_status::ok) {
return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x)); return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x));
} }
stack::push_popper_at pp(L, lua_absindex(L, -1), 1);
protected_function pf(L, -1); protected_function pf(L, -1);
pf.pop();
set_environment(env, pf); set_environment(env, pf);
return pf(); return pf();
} }
@ -13105,8 +13105,8 @@ namespace sol {
if (x != load_status::ok) { if (x != load_status::ok) {
return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x)); return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x));
} }
stack::push_popper_at pp(L, lua_absindex(L, -1), 1); protected_function pf(L, -1);
stack_protected_function pf(L, -1); pf.pop();
set_environment(env, pf); set_environment(env, pf);
return pf(); return pf();
} }
@ -13116,8 +13116,8 @@ namespace sol {
if (x != load_status::ok) { if (x != load_status::ok) {
return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x)); return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x));
} }
stack::push_popper_at pp(L, lua_absindex(L, -1), 1); protected_function pf(L, -1);
stack_protected_function pf(L, -1); pf.pop();
return pf(); return pf();
} }
@ -13126,8 +13126,8 @@ namespace sol {
if (x != load_status::ok) { if (x != load_status::ok) {
return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x)); return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x));
} }
stack::push_popper_at pp(L, lua_absindex(L, -1), 1);
protected_function pf(L, -1); protected_function pf(L, -1);
pf.pop();
return pf(); return pf();
} }

View File

@ -263,8 +263,8 @@ namespace sol {
if (x != load_status::ok) { if (x != load_status::ok) {
return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x)); return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x));
} }
stack::push_popper_at pp(L, lua_absindex(L, -1), 1);
protected_function pf(L, -1); protected_function pf(L, -1);
pf.pop();
set_environment(env, pf); set_environment(env, pf);
return pf(); return pf();
} }
@ -275,8 +275,8 @@ namespace sol {
if (x != load_status::ok) { if (x != load_status::ok) {
return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x)); return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x));
} }
stack::push_popper_at pp(L, lua_absindex(L, -1), 1); protected_function pf(L, -1);
stack_protected_function pf(L, -1); pf.pop();
set_environment(env, pf); set_environment(env, pf);
return pf(); return pf();
} }
@ -286,8 +286,8 @@ namespace sol {
if (x != load_status::ok) { if (x != load_status::ok) {
return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x)); return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x));
} }
stack::push_popper_at pp(L, lua_absindex(L, -1), 1); protected_function pf(L, -1);
stack_protected_function pf(L, -1); pf.pop();
return pf(); return pf();
} }
@ -296,8 +296,8 @@ namespace sol {
if (x != load_status::ok) { if (x != load_status::ok) {
return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x)); return protected_function_result(L, -1, 0, 1, static_cast<call_status>(x));
} }
stack::push_popper_at pp(L, lua_absindex(L, -1), 1);
protected_function pf(L, -1); protected_function pf(L, -1);
pf.pop();
return pf(); return pf();
} }

View File

@ -68,6 +68,7 @@ TEST_CASE("state/require_script", "opening strings as 'requires' clauses") {
std::string code = "return { modfunc = function () return 221 end }"; std::string code = "return { modfunc = function () return 221 end }";
sol::state lua; sol::state lua;
sol::stack_guard sg(lua);
sol::table thingy1 = lua.require_script("thingy", code); sol::table thingy1 = lua.require_script("thingy", code);
sol::table thingy2 = lua.require_script("thingy", code); sol::table thingy2 = lua.require_script("thingy", code);
@ -88,6 +89,7 @@ TEST_CASE("state/require", "opening using a file") {
}; };
sol::state lua; sol::state lua;
sol::stack_guard sg(lua);
sol::table thingy1 = lua.require("thingy", open::open_func); sol::table thingy1 = lua.require("thingy", open::open_func);
sol::table thingy2 = lua.require("thingy", open::open_func); sol::table thingy2 = lua.require("thingy", open::open_func);
@ -258,6 +260,7 @@ return example;
}; };
sol::state lua; sol::state lua;
sol::stack_guard sg(lua);
lua.open_libraries(); lua.open_libraries();
lua.set_function("foo", foo); lua.set_function("foo", foo);
@ -282,6 +285,7 @@ TEST_CASE("state/copy-move", "ensure state can be properly copied and moved") {
TEST_CASE("state/requires-reload", "ensure that reloading semantics do not cause a crash") { TEST_CASE("state/requires-reload", "ensure that reloading semantics do not cause a crash") {
sol::state lua; sol::state lua;
sol::stack_guard sg(lua);
lua.open_libraries(); lua.open_libraries();
lua.script("require 'io'\nreturn 'test1'"); lua.script("require 'io'\nreturn 'test1'");
lua.require_script("test2", "require 'io'\nreturn 'test2'"); lua.require_script("test2", "require 'io'\nreturn 'test2'");
@ -298,6 +302,7 @@ TEST_CASE("state/script-do-load", "test success and failure cases for loading an
SECTION("script") { SECTION("script") {
sol::state lua; sol::state lua;
sol::stack_guard sg(lua);
int ar = lua.script(good); int ar = lua.script(good);
int a = lua["a"]; int a = lua["a"];
REQUIRE(a == 21); REQUIRE(a == 21);
@ -305,6 +310,7 @@ TEST_CASE("state/script-do-load", "test success and failure cases for loading an
} }
SECTION("script-handler") { SECTION("script-handler") {
sol::state lua; sol::state lua;
sol::stack_guard sg(lua);
auto errbs = lua.script(bad_syntax, sol::simple_on_error); auto errbs = lua.script(bad_syntax, sol::simple_on_error);
REQUIRE(!errbs.valid()); REQUIRE(!errbs.valid());
@ -320,6 +326,7 @@ TEST_CASE("state/script-do-load", "test success and failure cases for loading an
} }
SECTION("do_string") { SECTION("do_string") {
sol::state lua; sol::state lua;
sol::stack_guard sg(lua);
auto errbs = lua.do_string(bad_syntax); auto errbs = lua.do_string(bad_syntax);
REQUIRE(!errbs.valid()); REQUIRE(!errbs.valid());
@ -335,6 +342,7 @@ TEST_CASE("state/script-do-load", "test success and failure cases for loading an
} }
SECTION("load_string") { SECTION("load_string") {
sol::state lua; sol::state lua;
sol::stack_guard sg(lua);
auto errbsload = lua.load(bad_syntax); auto errbsload = lua.load(bad_syntax);
REQUIRE(!errbsload.valid()); REQUIRE(!errbsload.valid());
@ -364,6 +372,7 @@ TEST_CASE("state/script-do-load", "test success and failure cases for loading an
} }
SECTION("script_file") { SECTION("script_file") {
sol::state lua; sol::state lua;
sol::stack_guard sg(lua);
int ar = lua.script_file(file_good); int ar = lua.script_file(file_good);
int a = lua["a"]; int a = lua["a"];
REQUIRE(a == 21); REQUIRE(a == 21);
@ -371,6 +380,7 @@ TEST_CASE("state/script-do-load", "test success and failure cases for loading an
} }
SECTION("script_file-handler") { SECTION("script_file-handler") {
sol::state lua; sol::state lua;
sol::stack_guard sg(lua);
auto errbs = lua.script_file(file_bad_syntax, sol::simple_on_error); auto errbs = lua.script_file(file_bad_syntax, sol::simple_on_error);
REQUIRE(!errbs.valid()); REQUIRE(!errbs.valid());
@ -386,6 +396,7 @@ TEST_CASE("state/script-do-load", "test success and failure cases for loading an
} }
SECTION("do_file") { SECTION("do_file") {
sol::state lua; sol::state lua;
sol::stack_guard sg(lua);
auto errbs = lua.do_file(file_bad_syntax); auto errbs = lua.do_file(file_bad_syntax);
REQUIRE(!errbs.valid()); REQUIRE(!errbs.valid());
@ -401,6 +412,7 @@ TEST_CASE("state/script-do-load", "test success and failure cases for loading an
} }
SECTION("load_file") { SECTION("load_file") {
sol::state lua; sol::state lua;
sol::stack_guard sg(lua);
auto errbsload = lua.load_file(file_bad_syntax); auto errbsload = lua.load_file(file_bad_syntax);
REQUIRE(!errbsload.valid()); REQUIRE(!errbsload.valid());