Esempio n. 1
0
        public void Run(Context cx)
        {
            cx.SetReg((ushort)(this.A + 1), cx.R(this.B));
            cx.SetReg(this.A, cx.LoadTable(B, cx.RK(C)));

            cx.SetSReg((ushort)(this.A + 1), cx.SR(this.B));
            cx.SetSReg(this.A, cx.SR(B) + "[" + cx.SRK(C) + "]");
        }
Esempio n. 2
0
 public override string ToString(Context cx)
 {
     if (!istart)
     {
         return("end");
     }
     else
     {
         return("for " + cx.SR(A) + "=" + cx.R(A).ToString() + ", " + cx.SR((ushort)(A + 1)) + ", " + cx.SR((ushort)(A + 2)) + " do ");
     }
 }
Esempio n. 3
0
 public override string ToString(Context cx)
 {
     if (A == B)
     {
         if (!ObjLuaFunction.DEBUG)
         {
             return("");
         }
         return("/// " + AssignA(cx, cx.SR(B)));
     }
     return(AssignA(cx, cx.SR(B)));
 }
Esempio n. 4
0
        public override string ToString(Context cx)
        {
            object o = cx.R(A);

            if (o is ObjLuaFunction)
            {
                return(cx.SR(A).Replace("{{name}}", Kst(BX)));
            }
            else
            {
                return(Kst(BX) + " = " + cx.SR(A));
            }
        }
Esempio n. 5
0
 public override string ToString(Context cx)
 {
     if (cx.IsLocal(A))
     {
         return(cx.LocalName(A) + " = !" + cx.SR(B));
     }
     else
     {
         if (!ObjLuaFunction.DEBUG)
         {
             return("");
         }
         return("// " + R(A) + " = !" + cx.SR(B));
     }
 }
Esempio n. 6
0
        public override string ToString(Context cx)
        {
            /*if (!ObjLuaFunction.DEBUG)	return "";
             * return "// " + R(A) + " = " + cx.SR(B)+"["+cx.SRK(C)+"]";*/

            return(AssignA(cx, cx.SR(B) + "[" + cx.SRK(C) + "]"));
        }
Esempio n. 7
0
        public override string ToString(Context cx)
        {
            object o = cx.RK(C);

            if (o is ObjLuaFunction)
            {
                string s = cx.SRK(C).Replace("{{name}}", "function_" + cx.PC);
                s += "\n" + cx.Indent;
                s += cx.SR(A) + "[" + cx.SRK(B) + "]" + " = " + "function_" + cx.PC;
                return(s);
            }
            else
            {
                return(cx.SR(A) + "[" + cx.SRK(B) + "]" + " = " + cx.SRK(C));
            }
        }
Esempio n. 8
0
 public void Run(Context cx)
 {
     //cx.SetReg(this.A, cx.R(this.B));
     for (int i = A; i <= A + C - 2; i++)
     {
         cx.SetReg((ushort)i, Context.Nil);
         cx.SetSReg((ushort)i, cx.SR(A) + "(" + cx.ListSR(A + 1, A + B - 1, "") + ")" /*+".Result["+i+"]"*/);
     }
 }
Esempio n. 9
0
        public override string ToString(Context cx)
        {
            string content  = cx.SR(A) + "(" + cx.ListSR(A + 1, A + B - 1, "") + ")";
            bool   haslocal = false;

            for (ushort i = A; i <= A + C - 2; i++)
            {
                if (!cx.IsLocal(i))
                {
                    cx.DefineLocal(i);                                     //this fails, if this Register is used otherwise later
                }
                if (cx.IsLocal(i))
                {
                    haslocal = true;
                }
            }

            if (A <= A + C - 2)
            {
                if (!haslocal)
                {
                    if (!ObjLuaFunction.DEBUG)
                    {
                        return("");
                    }
                    return("// " + ListR(A, A + C - 2, " = ", ", ... ,") + content);
                }
                else
                {
                    string ret = "";
                    for (ushort i = A; i <= A + C - 2; i++)
                    {
                        if (i > A)
                        {
                            ret += ",";
                        }
                        if (cx.IsLocal(i))
                        {
                            ret += cx.LocalName(i);
                        }
                        else
                        {
                            ret += R(i);
                        }
                    }

                    return(ret + " = " + content);
                }
            }

            return(content);
        }
Esempio n. 10
0
        public override string ToString(Context cx)
        {
            if (tfl == null)
            {
                return("");
            }

            string str = "for ";

            str += cx.ListSR(tfl.A + 2, tfl.A + 2 + tfl.C, "") + " in ";
            str += cx.SR(A) + " do ";


            return(str);
        }
Esempio n. 11
0
        public override string ToString(Context cx)
        {
            if (!cx.IsLocal(A))
            {
                cx.DefineLocal(A);                                 //this fails, if this Register is used otherwise later
            }
            if (cx.IsLocal(A))
            {
                return("local " + cx.SR(A) + " = " + cx.SKst(BX));
            }

            if (!ObjLuaFunction.DEBUG)
            {
                return("");
            }
            return("// " + R(A) + " = " + cx.SKst(BX));
        }
Esempio n. 12
0
        public void Run(Context cx)
        {
            string v  = "";
            string sv = "";

            for (ushort i = B; i <= C; i++)
            {
                v += cx.R(i).ToString();
                if (i != B)
                {
                    v += " .. ";
                }
                sv += cx.SR(i).ToString();
            }

            cx.SetReg(this.A, v);
            cx.SetSReg(this.A, sv);
        }
Esempio n. 13
0
 public void Run(Context cx)
 {
     cx.SetReg(A, cx.LoadTable(B, cx.RK(C)));
     cx.SetSReg(A, cx.SR(B) + "[" + cx.SRK(C) + "]");
 }
Esempio n. 14
0
 public void Run(Context cx)
 {
     cx.SetReg(this.A, !Convert.ToBoolean(cx.R(this.B)));
     cx.SetSReg(A, "!" + cx.SR(B));
 }
Esempio n. 15
0
 public override string ToString(Context cx)
 {
     return("if (" + cx.SR(A) + " ~= " + C + ") then \n" + cx.Indent + AssignA(cx, cx.SR(B)) + "\n");
 }
Esempio n. 16
0
 public override string ToString(Context cx)
 {
     return(Assign((ushort)(this.A + 1), cx, cx.SR(B)) + "\n" + cx.Indent + AssignA(cx, cx.SR(B) + "[" + cx.SRK(C) + "]"));
 }
Esempio n. 17
0
 public void Run(Context cx)
 {
     cx.SetReg(this.A, cx.R(this.B));
     cx.SetSReg(this.A, cx.SR(this.B));
 }
Esempio n. 18
0
 public void Run(Context cx)
 {
     cx.SetReg(this.A, -1 * Convert.ToDouble(cx.R(this.B)));
     cx.SetSReg(A, "-" + cx.SR(B));
 }