Пример #1
0
        /// <summary>
        /// Parses and executes the specified string
        /// </summary>
        public LuaArguments DoString(string Chunk)
        {
            FunctionDefinition def = new FunctionDefinition();

            def.Arguments = new List <Argument>();
            def.Body      = p.ParseString(Chunk);
            var function = LuaCompiler.CompileFunction(def, Expression.Constant(ctx)).Compile();

            return(function().Call(Lua.Return()));
        }
Пример #2
0
        /// <summary>
        /// Parses and executes the specified parsed block
        /// </summary>
        public LuaArguments DoAst(Block block)
        {
            FunctionDefinition def = new FunctionDefinition();

            def.Arguments = new List <Argument>();
            def.Body      = block;
            var function = LuaCompiler.CompileFunction(def, Expression.Constant(ctx)).Compile();

            return(function().Call(Lua.Return()));
        }
Пример #3
0
        /// <summary>
        /// Parses and executes the specified file
        /// </summary>
        /// <param name="Filename">The file to execute</param>
        public LuaArguments DoFile(string Filename)
        {
            #if INTERPRETED
            LuaInterpreter.LuaReturnStatus ret;
            return(LuaInterpreter.EvalBlock(p.ParseFile(Filename), ctx, out ret));
            #endif

            #if COMPILED
            FunctionDefinition def = new FunctionDefinition();
            def.Arguments = new List <Argument>();
            def.Body      = p.ParseFile(Filename);
            var function = LuaCompiler.CompileFunction(def, Expression.Constant(ctx)).Compile();
            return(function().Call(Lua.Return()));
            #endif
        }