mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 06:39:42 +00:00
Merge branch 'fix2' into 'master'
Fixes in components/lua Closes #6535 See merge request OpenMW/openmw!1538
This commit is contained in:
commit
1d4de71d35
2 changed files with 4 additions and 1 deletions
|
@ -99,6 +99,9 @@ namespace LuaUtil
|
|||
{
|
||||
if (mI18nLoader == sol::nil)
|
||||
throw std::runtime_error("LuaUtil::I18nManager is not initialized");
|
||||
auto it = mContexts.find(contextName);
|
||||
if (it != mContexts.end())
|
||||
return sol::make_object(mLua->sol(), it->second);
|
||||
Context ctx{contextName, mLua->newTable(), call(mI18nLoader, "i18n.init")};
|
||||
ctx.updateLang(this);
|
||||
mContexts.emplace(contextName, ctx);
|
||||
|
|
|
@ -170,7 +170,7 @@ namespace LuaUtil
|
|||
sol::environment env(mLua, sol::create, mSandboxEnv);
|
||||
sol::table loaded(mLua, sol::create);
|
||||
for (const std::string& s : safePackages)
|
||||
loaded[s] = mSandboxEnv[s];
|
||||
loaded[s] = static_cast<sol::object>(mSandboxEnv[s]);
|
||||
env["require"] = [this, loaded, env](const std::string& module) mutable
|
||||
{
|
||||
if (loaded[module] != sol::nil)
|
||||
|
|
Loading…
Reference in a new issue