Skip to content

Commit e8c8cac

Browse files
committed
Hotfix for hotkeys
1 parent 2fb6047 commit e8c8cac

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/scripting/ScriptContext.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ ScriptContext::ScriptContext(LuaSandbox& aLuaSandbox, const std::filesystem::pat
5757
m_logger->error("Tried to register an unknown event '{}'!", acName);
5858
};
5959

60-
env["registerHotkey"] = [this](const std::string& acID, const std::string& acDescription, sol::function aCallback)
60+
env["registerHotkey"] = [this, &env](const std::string& acID, const std::string& acDescription, sol::function aCallback)
6161
{
6262
if (acID.empty() ||
6363
(std::find_if(acID.cbegin(), acID.cend(), [](char c){ return !(isalpha(c) || isdigit(c) || c == '_'); }) != acID.cend()))
@@ -74,11 +74,8 @@ ScriptContext::ScriptContext(LuaSandbox& aLuaSandbox, const std::filesystem::pat
7474

7575
auto loggerRef = m_logger;
7676
std::string vkBindID = m_name + '.' + acID;
77-
VKBind vkBind = { vkBindID, acDescription, [loggerRef, aCallback, this]()
77+
VKBind vkBind = { vkBindID, acDescription, [loggerRef, aCallback, &env]()
7878
{
79-
auto& sb = m_sandbox[m_sandboxID];
80-
auto& env = sb.GetEnvironment();
81-
8279
TryLuaFunction(loggerRef, env, aCallback);
8380
}};
8481

0 commit comments

Comments
 (0)