Skip to content

Commit

Permalink
Functions are not cached anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
maximegmd committed Feb 13, 2021
1 parent b48bb5e commit 69a3a82
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/reverse/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,23 @@ sol::object ClassType::Index_Impl(const std::string& acName, sol::this_environme
}
}

auto obj = make_object(m_lua, [pFunc, name = acName](Type* apType, sol::variadic_args aArgs, sol::this_environment aThisEnv, sol::this_state L)
auto obj = make_object(m_lua, [pType, name = acName](Type* apType, sol::variadic_args aArgs,
sol::this_environment aThisEnv, sol::this_state L)
{
// We need to retrieve the function everytime as they can change with this
auto* pFunc = pType->GetFunction(RED4ext::FNV1a(name.c_str()));
if (!pFunc)
{
for (uint32_t i = 0; i < pType->funcs.size; ++i)
{
if (pType->funcs.entries[i]->fullName.hash == RED4ext::FNV1a(name.c_str()))
{
pFunc = static_cast<RED4ext::CClassFunction*>(pType->funcs.entries[i]);
break;
}
}
}

std::string result;
auto funcRet = apType->Execute(pFunc, name, aArgs, aThisEnv, L, result);
if (!result.empty())
Expand Down

0 comments on commit 69a3a82

Please sign in to comment.