lua: change a reference variable to a non-reference type

This line was not an error -- it is legal in C++ to bind a const
reference to a temporary value. It's only slightly more confusing
than usual in this case because the string it is built from is
a C-string owned by lua, and the temporary std::string object is
implicit.

I don't believe this commit will even make any difference in the
compiled code, it's only slightly simpler and more readable.
This commit is contained in:
Chris Beck 2015-01-06 00:00:04 -05:00
parent 7a9a13c80d
commit 7adde8af9c

View file

@ -709,7 +709,7 @@ int game_lua_kernel::intf_get_variable(lua_State *L)
*/
int game_lua_kernel::intf_set_variable(lua_State *L)
{
const std::string& m = luaL_checkstring(L, 1);
const std::string m = luaL_checkstring(L, 1);
if(m.empty()) return luaL_argerror(L, 1, "empty variable name");
if (lua_isnoneornil(L, 2)) {
gamedata().clear_variable(m);