From 9344a79233882ac278b3812b91b6edf874ef5d16 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Thu, 17 Mar 2011 00:42:38 +0100 Subject: 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 --- src/scripting/lua.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/scripting/lua.cpp') 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); } -- cgit v1.2.3-70-g09d2