diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-03-17 00:42:38 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-03-17 00:57:16 +0100 |
commit | 9344a79233882ac278b3812b91b6edf874ef5d16 (patch) | |
tree | e5bd324104a9d8dcf1839de8a880845f8739a37a /src/scripting/lua.cpp | |
parent | 0e24b15a386d45f43cea76c1b8ad744728a3190e (diff) | |
download | manaserv-9344a79233882ac278b3812b91b6edf874ef5d16.tar.gz manaserv-9344a79233882ac278b3812b91b6edf874ef5d16.tar.bz2 manaserv-9344a79233882ac278b3812b91b6edf874ef5d16.tar.xz manaserv-9344a79233882ac278b3812b91b6edf874ef5d16.zip |
Micro-optimizations related to std::string
* Rely on the fact that a std::string is empty by default
* Use std::string::empty() rather than comparing to ""
* Construct with std::string() rather than from ""
Reviewed-by: Bertram
Diffstat (limited to 'src/scripting/lua.cpp')
-rw-r--r-- | src/scripting/lua.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 11f42f50..e0cd4e16 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -1241,9 +1241,9 @@ static int chatmessage(lua_State *s) if (lua_gettop(s) == 2 && lua_isuserdata(s, 1) && lua_isstring(s, 2) ) { Being *being = getBeing(s, 1); - std::string message = lua_tostring(s, 2); + const std::string message = lua_tostring(s, 2); - if (being && message != "") + if (being && !message.empty()) { GameState::sayTo(being, NULL, message); } |