ripple-tool / Ripple-Data / Control / Commands / Scripter.cs
Scripter.cs
Raw
using MoonSharp.Interpreter;
using MoonSharp.Interpreter.Interop;
using Ripple_Data.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Ripple_Data.Control.Commands
{
    public class Scripter
    {
        private static Lazy<Scripter> _lazy = new Lazy<Scripter>(() => new Scripter());
        public static Scripter Instance { get { return _lazy.Value; } }
        public Script LuaScript { get; private set; }
        public Scripter()
        {
            UserData.RegistrationPolicy = InteropRegistrationPolicy.Default;
            UserData.RegisterType<IIdentifyable>();
            UserData.RegisterAssembly(Assembly.GetExecutingAssembly(), true);
            LuaScript = new Script();
            LuaManager luaManager = new LuaManager();
            LuaScript.Globals["Manager"] = luaManager;
            //LuaScript.Globals[$"{obj.GetType()}"] = obj;

        }
    }
}