예제 #1
0
        private static void comparison(lua_Type tag_less, lua_Type tag_equal,
                                       lua_Type tag_great, CharPtr op)
        {
            Object_ l = top.get(-2);
            Object_ r = top.get(-1);
            int     result;

            if (tag(l) == lua_Type.LUA_T_NUMBER && tag(r) == lua_Type.LUA_T_NUMBER)
            {
                result = (nvalue(l) < nvalue(r)) ? -1 : (nvalue(l) == nvalue(r)) ? 0 : 1;
            }
            else if (tostring(l) || tostring(r))
            {
                lua_pushstring(op);
                do_call(luaI_fallBacks[FB_ORDER].function, ObjectRef.minus(top, stack) - 3, 1, ObjectRef.minus(top, stack) - 3);
                return;
            }
            else
            {
                result = strcmp(svalue(l), svalue(r));
            }
            top.dec();
            nvalue(top.get(-1), 1);
            tag(top.get(-1), (result < 0) ? tag_less : ((result == 0) ? tag_equal : tag_great));
        }
예제 #2
0
        public static void tag(Object_ o, lua_Type t)
        {
//			if (t == Type.T_NUMBER)
//			{
//				Console.WriteLine("==============");
//			}
            o.tag = t;
        }
예제 #3
0
 public static void s_tag(int i, lua_Type t)
 {
     tag(s_object(i), t);
 }
예제 #4
0
 public Symbol(lua_Type tag, Cfunction f)
 {
     this.object_.tag     = tag;
     this.object_.value.f = f;
 }
예제 #5
0
 public Object_(lua_Type tag, Cfunction f)
 {
     this._tag    = tag;
     this.value.f = f;
 }
예제 #6
0
 public void set(Object_ obj)
 {
     this.tag = obj.tag;
     this.value.set(obj.value);
 }