Load some default Lua libraries

This commit is contained in:
Thorsten Sommer 2025-03-18 13:13:41 +01:00
parent a87cd41d7b
commit abeee2408f
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -1,4 +1,5 @@
using Lua;
using Lua.Standard;
// ReSharper disable MemberCanBePrivate.Global
namespace AIStudio.Tools.PluginSystem;
@ -85,6 +86,14 @@ public abstract class PluginBase
// For security reasons, we don't want to allow the plugin to load modules:
this.state.ModuleLoader = new NoModuleLoader();
// Add some useful libraries:
this.state.OpenModuleLibrary();
this.state.OpenStringLibrary();
this.state.OpenTableLibrary();
this.state.OpenMathLibrary();
this.state.OpenBitwiseLibrary();
this.state.OpenCoroutineLibrary();
var issues = new List<string>();
if(!string.IsNullOrWhiteSpace(parseError))
issues.Add(parseError);