Skip to content

Commit

Permalink
lua: remove core.cause_error call (#5637)
Browse files Browse the repository at this point in the history
it was used in minimal to trigger core crash, not very useful
  • Loading branch information
nerzhul committed Apr 21, 2017
1 parent dc0e909 commit 113c85a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 144 deletions.
106 changes: 0 additions & 106 deletions games/minimal/mods/errorhandler_test/init.lua

This file was deleted.

33 changes: 0 additions & 33 deletions src/script/lua_api/l_server.cpp
Expand Up @@ -483,36 +483,6 @@ int ModApiServer::l_set_last_run_mod(lua_State *L)
return 0;
}

#ifndef NDEBUG
// cause_error(type_of_error)
int ModApiServer::l_cause_error(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
std::string type_of_error = "none";
if(lua_isstring(L, 1))
type_of_error = lua_tostring(L, 1);

errorstream << "Error handler test called, errortype=" << type_of_error << std::endl;

if(type_of_error == "segv") {
volatile int* some_pointer = 0;
errorstream << "Cause a sigsegv now: " << (*some_pointer) << std::endl;

} else if (type_of_error == "zerodivision") {

unsigned int some_number = porting::getTimeS();
unsigned int zerovalue = 0;
unsigned int result = some_number / zerovalue;
errorstream << "Well this shouldn't ever be shown: " << result << std::endl;

} else if (type_of_error == "exception") {
throw BaseException("Errorhandler test fct called");
}

return 0;
}
#endif

void ModApiServer::Initialize(lua_State *L, int top)
{
API_FCT(request_shutdown);
Expand Down Expand Up @@ -545,7 +515,4 @@ void ModApiServer::Initialize(lua_State *L, int top)

API_FCT(get_last_run_mod);
API_FCT(set_last_run_mod);
#ifndef NDEBUG
API_FCT(cause_error);
#endif
}
5 changes: 0 additions & 5 deletions src/script/lua_api/l_server.h
Expand Up @@ -101,11 +101,6 @@ class ModApiServer : public ModApiBase
// set_last_run_mod(modname)
static int l_set_last_run_mod(lua_State *L);

#ifndef NDEBUG
// cause_error(type_of_error)
static int l_cause_error(lua_State *L);
#endif

public:
static void Initialize(lua_State *L, int top);
};
Expand Down

0 comments on commit 113c85a

Please sign in to comment.