aboutsummaryrefslogtreecommitdiff
path: root/src/lanes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lanes.cpp')
-rw-r--r--src/lanes.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/lanes.cpp b/src/lanes.cpp
index 472b501..47ca79a 100644
--- a/src/lanes.cpp
+++ b/src/lanes.cpp
@@ -655,22 +655,16 @@ static constexpr UniqueKey EXTENDED_STACKTRACE_REGKEY{ 0x2357c69a7c92c936ull };
655LUAG_FUNC( set_error_reporting) 655LUAG_FUNC( set_error_reporting)
656{ 656{
657 luaL_checktype(L, 1, LUA_TSTRING); 657 luaL_checktype(L, 1, LUA_TSTRING);
658 char const* mode{ lua_tostring(L, 1) };
658 lua_pushliteral(L, "extended"); 659 lua_pushliteral(L, "extended");
659 int equal = lua_rawequal(L, -1, 1); 660 bool const extended{ strcmp(mode, "extended") == 0 };
660 lua_pop(L, 1); 661 bool const basic{ strcmp(mode, "basic") == 0 };
661 if (equal) 662 if (!extended && !basic)
662 { 663 {
663 goto done; 664 return luaL_error(L, "unsupported error reporting model %s", mode);
664 } 665 }
665 lua_pushliteral(L, "basic"); 666
666 equal = !lua_rawequal(L, -1, 1); 667 EXTENDED_STACKTRACE_REGKEY.setValue(L, [extended](lua_State* L) { lua_pushboolean(L, extended ? 1 : 0); });
667 lua_pop(L, 1);
668 if (equal)
669 {
670 return luaL_error(L, "unsupported error reporting model");
671 }
672done:
673 EXTENDED_STACKTRACE_REGKEY.setValue(L, [equal](lua_State* L) { lua_pushboolean(L, equal); });
674 return 0; 668 return 0;
675} 669}
676 670