lua: give more specific errors for "unknown modifiable property"
This commit is contained in:
parent
a1a2e0e527
commit
1f124ff2ee
2 changed files with 10 additions and 3 deletions
|
@ -342,7 +342,9 @@ static int impl_unit_set(lua_State *L)
|
|||
modify_int_attrib("y", loc.y = value - 1; u.set_location(loc));
|
||||
}
|
||||
|
||||
return luaL_argerror(L, 2, "unknown modifiable property");
|
||||
std::string err_msg = "unknown modifiable property of unit: ";
|
||||
err_msg += m;
|
||||
return luaL_argerror(L, 2, err_msg.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1256,7 +1258,10 @@ int game_lua_kernel::impl_game_config_set(lua_State *L)
|
|||
modify_int_attrib("recall_cost", game_config::recall_cost = value);
|
||||
modify_int_attrib("kill_experience", game_config::kill_experience = value);
|
||||
modify_int_attrib("last_turn", tod_man().set_number_of_turns(value));
|
||||
return luaL_argerror(L, 2, "unknown modifiable property");
|
||||
|
||||
std::string err_msg = "unknown modifiable property of game_config: ";
|
||||
err_msg += m;
|
||||
return luaL_argerror(L, 2, err_msg.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -129,7 +129,9 @@ static int impl_side_set(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
return luaL_argerror(L, 2, "unknown modifiable property");
|
||||
std::string err_msg = "unknown modifiable property of side: ";
|
||||
err_msg += m;
|
||||
return luaL_argerror(L, 2, err_msg.c_str());
|
||||
}
|
||||
|
||||
namespace lua_team {
|
||||
|
|
Loading…
Add table
Reference in a new issue