From e1645f37fc72e7733b64c51ffbee0370e13cbe29 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Wed, 19 Jul 2023 01:16:22 +1000 Subject: Support for player entity message commands --- source/game/scripting/StarLuaRoot.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/game/scripting/StarLuaRoot.cpp') diff --git a/source/game/scripting/StarLuaRoot.cpp b/source/game/scripting/StarLuaRoot.cpp index d41e8fc..5aa0284 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 const& name, Maybe 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); -- cgit v1.2.3