Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
psiberx committed Nov 28, 2021
1 parent ffea536 commit b483e48
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
16 changes: 3 additions & 13 deletions src/scripting/Scripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,18 +658,6 @@ sol::object Scripting::Index(const std::string& acName, sol::this_state aState,
return itor->second;
}

return InternalIndex(acName, aState, aEnv);
}

sol::object Scripting::InternalNewIndex(const std::string& acName, sol::object aParam)
{
auto& property = m_properties[acName];
property = std::move(aParam);
return property;
}

sol::protected_function Scripting::InternalIndex(const std::string& acName, sol::this_state aState, sol::this_environment aEnv)
{
auto func = RTTIHelper::Get().ResolveFunction(acName);

if (!func)
Expand All @@ -690,7 +678,9 @@ sol::protected_function Scripting::InternalIndex(const std::string& acName, sol:
return sol::nil;
}

return InternalNewIndex(acName, std::move(func));
auto& property = m_properties[acName];
property = std::move(func);
return property;
}

sol::object Scripting::GetSingletonHandle(const std::string& acName, sol::this_environment aThisEnv)
Expand Down
3 changes: 0 additions & 3 deletions src/scripting/Scripting.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ struct Scripting
void RegisterOverrides();

sol::object Index(const std::string& acName, sol::this_state aState, sol::this_environment aEnv);
sol::object InternalNewIndex(const std::string& acName, sol::object aParam);
sol::object GetSingletonHandle(const std::string& acName, sol::this_environment aThisEnv);
sol::protected_function InternalIndex(const std::string& acName, sol::this_state aState,
sol::this_environment aEnv);

private:
TiltedPhoques::Lockable<sol::state, std::recursive_mutex> m_lua;
Expand Down

0 comments on commit b483e48

Please sign in to comment.