Skip to content

Commit

Permalink
partially revert 797613f
Browse files Browse the repository at this point in the history
attempts to fix bug reported by tad_carlucci

discussed on #wesnoth-dev 10-19-2016
  • Loading branch information
cbeck88 committed Oct 20, 2016
1 parent 166809e commit e9d72ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
8 changes: 2 additions & 6 deletions src/scripting/lua_common.cpp
Expand Up @@ -922,10 +922,6 @@ void chat_message(std::string const &caption, std::string const &msg)
events::chat_handler::MESSAGE_PUBLIC, false);
}

// To silence "no prototype" warnings
void push_error_handler(lua_State *L);
int luaW_pcall_internal(lua_State *L, int nArgs, int nRets);

void push_error_handler(lua_State *L)
{
luaW_getglobal(L, "debug", "traceback");
Expand All @@ -943,11 +939,11 @@ int luaW_pcall_internal(lua_State *L, int nArgs, int nRets)
// Call the function.
int errcode = lua_pcall(L, nArgs, nRets, -2 - nArgs);

tlua_jailbreak_exception::rethrow();

// Remove the error handler.
lua_remove(L, error_handler_index);

tlua_jailbreak_exception::rethrow();

return errcode;
}

Expand Down
5 changes: 5 additions & 0 deletions src/scripting/lua_common.hpp
Expand Up @@ -179,6 +179,11 @@ void chat_message(std::string const &caption, std::string const &msg);
*/
bool luaW_pcall(lua_State *L, int nArgs, int nRets, bool allow_wml_error = false);

// Don't use these directly
void push_error_handler(lua_State *L);
int luaW_pcall_internal(lua_State *L, int nArgs, int nRets);


int luaW_type_error (lua_State *L, int narg, const char *tname);

#define return_tstring_attrib(name, accessor) \
Expand Down
4 changes: 0 additions & 4 deletions src/scripting/lua_kernel_base.cpp
Expand Up @@ -223,8 +223,6 @@ int dispatch(lua_State *L) {
return ((lua_kernel_base::get_lua_kernel<lua_kernel_base>(L)).*method)(L);
}

extern void push_error_handler(lua_State *L);

// Ctor, initialization
lua_kernel_base::lua_kernel_base()
: mState(luaL_newstate())
Expand Down Expand Up @@ -458,8 +456,6 @@ bool lua_kernel_base::protected_call(int nArgs, int nRets, error_handler e_h)
return this->protected_call(mState, nArgs, nRets, e_h);
}

extern int luaW_pcall_internal(lua_State *L, int nArgs, int nRets);

bool lua_kernel_base::protected_call(lua_State * L, int nArgs, int nRets, error_handler e_h)
{
int errcode = luaW_pcall_internal(L, nArgs, nRets);
Expand Down

0 comments on commit e9d72ad

Please sign in to comment.