示例#1
0
        public void Run(Context cx)
        {
            ObjLuaFunction fkt = cx.KProto(BX);

            cx.SetReg(this.A, fkt);

            System.IO.StreamWriter sw = new System.IO.StreamWriter(new System.IO.MemoryStream());
            string  paramlist;
            Context scx = cx.CreateSubContext(fkt, out paramlist);

            sw.WriteLine();
            sw.WriteLine(cx.Indent + "function {{name}}(" + paramlist + ")");
            fkt.ToSource(sw, scx);
            sw.Write(cx.Indent + "end");
            sw.WriteLine();

            sw.Flush();
            sw.BaseStream.Seek(0, System.IO.SeekOrigin.Begin);
            System.IO.StreamReader sr = new System.IO.StreamReader(sw.BaseStream);
            cx.SetSReg(A, sr.ReadToEnd());
            sw.Close();
        }