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:
parent
7a9a13c80d
commit
7adde8af9c
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue