diff --git a/stepmania/src/ActorCommands.cpp b/stepmania/src/ActorCommands.cpp index e15e484efb..e9468911c9 100644 --- a/stepmania/src/ActorCommands.cpp +++ b/stepmania/src/ActorCommands.cpp @@ -43,7 +43,12 @@ ActorCommands &ActorCommands::operator=( const ActorCommands& cpy ) if( this == &cpy ) return *this; - *this = cpy; + Unregister(); + + /* Make a new reference. */ + lua_rawgeti( LUA->L, LUA_REGISTRYINDEX, cpy.m_iLuaFunction ); + m_iLuaFunction = luaL_ref( LUA->L, LUA_REGISTRYINDEX ); + return *this; }