From 562b403a66a6a96d883620b27455564d50e3d49b Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 9 Jan 2013 11:47:16 +0100 Subject: Micro-optimizations for pushing strings to Lua Use lua_pushliteral and lua_pushlstring instead of lua_pushstring, which avoids Lua having to determine the length of the string. --- src/scripting/luascript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/scripting/luascript.cpp') diff --git a/src/scripting/luascript.cpp b/src/scripting/luascript.cpp index a3dcb1d..4104bc8 100644 --- a/src/scripting/luascript.cpp +++ b/src/scripting/luascript.cpp @@ -82,7 +82,7 @@ void LuaScript::push(int v) void LuaScript::push(const std::string &v) { assert(nbArgs >= 0); - lua_pushstring(mCurrentState, v.c_str()); + lua_pushlstring(mCurrentState, v.c_str(), v.length()); ++nbArgs; } -- cgit