[Fix] More Lua stack balancing.

This commit is contained in:
Allanis 2014-05-17 14:25:55 +01:00
parent 04ed5fe1bc
commit 00384adf7b
3 changed files with 13 additions and 1 deletions

View File

@ -88,6 +88,8 @@ static int factionL_createmetatable(lua_State* L, int readonly) {
/* Register the values. */
luaL_register(L, NULL, (readonly) ? faction_methods_cond : faction_methods);
lua_pop(L, 1);
return 0; /* No error. */
}

View File

@ -290,7 +290,8 @@ static int misn_runTopStack(Mission* misn, char* func) {
cur_mission = misn;
misn_delete = 0;
if((ret = lua_pcall(misn->L, 0, 0, 0))) {
ret = lua_pcall(misn->L, 0, 0, 0);
if(ret != 0) { /* Error has occured. */
/* Did an oops. */
err = (lua_isstring(misn->L, -1)) ? (char*) lua_tostring(misn->L, -1) : NULL;
if(strcmp(err, "Mission Done")!=0)

View File

@ -124,6 +124,9 @@ static int planetL_createmetatable(lua_State* L) {
/* Register the values. */
luaL_register(L, NULL, planet_methods);
/* Clean up. */
lua_pop(L, 1);
return 0; /* No error. */
}
@ -143,6 +146,9 @@ static int systemL_createmetatable(lua_State* L) {
/* Register the values. */
luaL_register(L, NULL, system_methods);
/* Clean up. */
lua_pop(L, 1);
return 0; /* No error. */
}
@ -162,6 +168,9 @@ static int vectorL_createmetatable(lua_State* L) {
/* Register the values. */
luaL_register(L, NULL, vector_methods);
/* Clean up. */
lua_pop(L, 1);
return 0; /* No error. */
}