Client LuaCsForBarotrauma
LuaScriptLoader.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.IO;
5 using MoonSharp.Interpreter;
6 using MoonSharp.Interpreter.Loaders;
7 using System.Linq;
8 
9 namespace Barotrauma
10 {
11  class LuaScriptLoader : ScriptLoaderBase
12  {
13 
14  public override object LoadFile(string file, Table globalContext)
15  {
16  if (!LuaCsFile.IsPathAllowedLuaException(file, false)) return null;
17 
18  return File.ReadAllText(file);
19  }
20 
21  public override bool ScriptFileExists(string file)
22  {
23  if (!LuaCsFile.IsPathAllowedLuaException(file, false)) return false;
24 
25  return File.Exists(file);
26  }
27  }
28 }
static bool IsPathAllowedLuaException(string path, bool write=true)
override object LoadFile(string file, Table globalContext)
override bool ScriptFileExists(string file)