diff options
| author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2013-01-09 11:47:16 +0100 |
|---|---|---|
| committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2013-01-09 11:47:16 +0100 |
| commit | 562b403a66a6a96d883620b27455564d50e3d49b (patch) | |
| tree | 44b3f37bef0b44999dce6a1a941f6ff94baaa0e5 /src/scripting/luascript.cpp | |
| parent | 2594084de6e163f15a1516d64cf413de5b0d899f (diff) | |
| download | manaserv-562b403a66a6a96d883620b27455564d50e3d49b.tar.gz manaserv-562b403a66a6a96d883620b27455564d50e3d49b.tar.xz manaserv-562b403a66a6a96d883620b27455564d50e3d49b.zip | |
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.
Diffstat (limited to 'src/scripting/luascript.cpp')
| -rw-r--r-- | src/scripting/luascript.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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; } |
