Refactor and fix #56

This commit is contained in:
Evil Factory
2022-04-15 19:05:24 -03:00
parent 6eb575ea81
commit 42df433d3e
35 changed files with 144 additions and 97 deletions
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using MoonSharp.Interpreter;
using MoonSharp.Interpreter.Loaders;
using System.Linq;
namespace Barotrauma
{
class LuaScriptLoader : ScriptLoaderBase
{
public override object LoadFile(string file, Table globalContext)
{
if (!LuaCsFile.IsPathAllowedLuaException(file, false)) return null;
return File.ReadAllText(file);
}
public override bool ScriptFileExists(string file)
{
if (!LuaCsFile.IsPathAllowedLuaException(file, false)) return false;
return File.Exists(file);
}
}
}