Basic Lua loading prep.
TSHOCKPLUGINS-4
This commit is contained in:
parent
7e6aa3d288
commit
c45291eb6b
5 changed files with 49 additions and 5 deletions
38
TShockAPI/LuaSystem/LuaLoader.cs
Normal file
38
TShockAPI/LuaSystem/LuaLoader.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using LuaInterface;
|
||||
|
||||
namespace TShockAPI.LuaSystem
|
||||
{
|
||||
public class LuaLoader
|
||||
{
|
||||
private Lua Lua = null;
|
||||
public string LuaPath = "";
|
||||
public LuaLoader(string path)
|
||||
{
|
||||
Lua = new Lua();
|
||||
LuaPath = path;
|
||||
SendLuaDebugMsg("Lua 5.1 (serverside) initialized.");
|
||||
}
|
||||
|
||||
public void LoadServerAutoruns()
|
||||
{
|
||||
foreach (string s in Directory.GetFiles(Path.Combine(LuaPath, "autorun")))
|
||||
{
|
||||
Lua.DoFile(s);
|
||||
SendLuaDebugMsg("Loaded file: " + s);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendLuaDebugMsg(string s)
|
||||
{
|
||||
ConsoleColor previousColor = Console.ForegroundColor;
|
||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||
Console.WriteLine("Lua: " + s);
|
||||
Console.ForegroundColor = previousColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue