コード例 #1
0
ファイル: LibraryModule.cs プロジェクト: lexx23/ScriptEngine
        public LibraryModule()
        {
            LibraryClassAttribute attribute = (LibraryClassAttribute)Attribute.GetCustomAttribute(typeof(T), typeof(LibraryClassAttribute), false);

            InternalScriptType type = ScriptInterpreter.Interpreter.Programm.InternalTypes.Get(attribute.Name);

            _value = new ScriptObjectContext(type.Module, this);
        }
コード例 #2
0
        public IValue Type(IValue value)
        {
            InternalScriptType script_type = ScriptInterpreter.Interpreter.Programm.InternalTypes.Get(value.AsString());

            if (script_type == null)
            {
                throw new Exception($"Тип [{value.ToString()}] не определен.");
            }

            return(ValueFactory.Create(script_type));
        }
コード例 #3
0
        public IValue TypeOf(IValue value)
        {
            InternalScriptType script_type = value.ScriptType;

            if (script_type == null)
            {
                throw new Exception($"Тип [{value.ToString()}] не определен.");
            }

            return(ValueFactory.Create(script_type));
        }
コード例 #4
0
        public void AttachScript(string path, string type_name)
        {
            ScriptModule module = new ScriptModule(type_name, type_name, ModuleTypeEnum.OBJECT, false, path);

            ScriptInterpreter.Interpreter.Programm.AttachScript(module);
            InternalScriptType type = new InternalScriptType()
            {
                Name   = type_name,
                Alias  = type_name,
                Module = module,
            };

            ScriptInterpreter.Interpreter.Programm.InternalTypes.Add(type);
        }
コード例 #5
0
 public TypeValue(InternalScriptType value)
 {
     _value = value;
 }