diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-20 15:00:59 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-20 15:00:59 +1000 |
commit | c1ae23808677028ef6ac1b7f0b19b298d78affc2 (patch) | |
tree | 0310c9d5e4673ea49add9791713fdd83b81ed87f /source/game/scripting/StarLuaRoot.cpp | |
parent | 9d66acde2ae6896607da953e20ba5bbfc23948f6 (diff) | |
parent | 043db1841ee46ace0f6919bfdf6ac20a539faaca (diff) |
Merge branch 'voice'
Diffstat (limited to 'source/game/scripting/StarLuaRoot.cpp')
-rw-r--r-- | source/game/scripting/StarLuaRoot.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/game/scripting/StarLuaRoot.cpp b/source/game/scripting/StarLuaRoot.cpp index d41e8fc..152bbec 100644 --- a/source/game/scripting/StarLuaRoot.cpp +++ b/source/game/scripting/StarLuaRoot.cpp @@ -106,6 +106,11 @@ LuaContext LuaRoot::createContext(StringList const& scriptPaths) { } }); + newContext.set("loadstring", m_luaEngine->createFunction([newContext](String const& source, Maybe<String> const& name, Maybe<LuaValue> const& env) -> LuaFunction { + String functionName = name ? strf("loadstring: {}", *name) : "loadstring"; + return newContext.engine().createFunctionFromSource(newContext.handleIndex(), source.utf8Ptr(), source.utf8Size(), functionName.utf8Ptr()); + })); + for (auto const& scriptPath : scriptPaths) cache->loadContextScript(newContext, scriptPath); |