mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-13 08:58:35 +00:00
Extend lifetime of strings placed on the action queue
This commit is contained in:
parent
62d1cdcdac
commit
f0cee09b7c
@ -168,7 +168,8 @@ namespace MWLua
|
||||
if (index == LuaUi::Layer::count())
|
||||
throw std::logic_error(std::string("Layer not found"));
|
||||
index++;
|
||||
context.mLuaManager->addAction([=]() { LuaUi::Layer::insert(index, name, options); }, "Insert UI layer");
|
||||
context.mLuaManager->addAction(
|
||||
[=, name = std::string(name)]() { LuaUi::Layer::insert(index, name, options); }, "Insert UI layer");
|
||||
};
|
||||
layersTable["insertBefore"] = [context](
|
||||
std::string_view beforename, std::string_view name, const sol::object& opt) {
|
||||
@ -177,7 +178,8 @@ namespace MWLua
|
||||
size_t index = LuaUi::Layer::indexOf(beforename);
|
||||
if (index == LuaUi::Layer::count())
|
||||
throw std::logic_error(std::string("Layer not found"));
|
||||
context.mLuaManager->addAction([=]() { LuaUi::Layer::insert(index, name, options); }, "Insert UI layer");
|
||||
context.mLuaManager->addAction(
|
||||
[=, name = std::string(name)]() { LuaUi::Layer::insert(index, name, options); }, "Insert UI layer");
|
||||
};
|
||||
sol::table layers = LuaUtil::makeReadOnly(layersTable);
|
||||
sol::table layersMeta = layers[sol::metatable_key];
|
||||
@ -285,7 +287,7 @@ namespace MWLua
|
||||
return res;
|
||||
};
|
||||
api["_setWindowDisabled"]
|
||||
= [windowManager, luaManager = context.mLuaManager](std::string_view window, bool disabled) {
|
||||
= [windowManager, luaManager = context.mLuaManager](std::string window, bool disabled) {
|
||||
luaManager->addAction([=]() { windowManager->setDisabledByLua(window, disabled); });
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user