lua_equal() public static method

public static lua_equal ( IntPtr luaState, int index1, int index2 ) : int
luaState System.IntPtr
index1 int
index2 int
return int
Esempio n. 1
0
        /*
         * Compares the two values referenced by ref1 and ref2 for equality
         */
        internal bool compareRef(int ref1, int ref2)
        {
            int top = LuaDLL.lua_gettop(luaState);

            LuaDLL.lua_getref(luaState, ref1);
            LuaDLL.lua_getref(luaState, ref2);
            int equal = LuaDLL.lua_equal(luaState, -1, -2);

            LuaDLL.lua_settop(luaState, top);
            return(equal != 0);
        }
Esempio n. 2
0
        internal bool compareRef(int ref1, int ref2)
        {
            if (ref1 == ref2)
            {
                return(true);
            }
            int newTop = LuaDLL.lua_gettop(this.L);

            LuaDLL.lua_getref(this.L, ref1);
            LuaDLL.lua_getref(this.L, ref2);
            int num = LuaDLL.lua_equal(this.L, -1, -2);

            LuaDLL.lua_settop(this.L, newTop);
            return(num != 0);
        }
Esempio n. 3
0
        /*
         * Registers an object's method as a Lua function (global or table field)
         * The method may have any signature
         */
//         public LuaFunction RegisterFunction(string path, object target, MethodBase function /*MethodInfo function*/)  //CP: Fix for struct constructor by Alexander Kappner (link: http://luaforge.net/forum/forum.php?thread_id=2859&forum_id=145)
//         {
//             // We leave nothing on the stack when we are done
//             int oldTop = LuaDLL.lua_gettop(L);
//
//             LuaMethodWrapper wrapper = new LuaMethodWrapper(translator, target, function.DeclaringType, function);
//             translator.Push(L, new LuaCSFunction(wrapper.call));
//
//             this[path] = translator.GetObject(L, -1);
//             LuaFunction f = GetFunction(path);
//
//             LuaDLL.lua_settop(L, oldTop);
//
//             return f;
//         }
//
//         public LuaFunction CreateFunction(object target, MethodBase function /*MethodInfo function*/)  //CP: Fix for struct constructor by Alexander Kappner (link: http://luaforge.net/forum/forum.php?thread_id=2859&forum_id=145)
//         {
//             // We leave nothing on the stack when we are done
//             int oldTop = LuaDLL.lua_gettop(L);
//
//             LuaMethodWrapper wrapper = new LuaMethodWrapper(translator, target, function.DeclaringType, function);
//             translator.Push(L, new LuaCSFunction(wrapper.call));
//
//             object obj = translator.GetObject(L, -1);
//             LuaFunction f = (obj is LuaCSFunction ? new LuaFunction((LuaCSFunction)obj, this) : (LuaFunction)obj);
//
//             LuaDLL.lua_settop(L, oldTop);
//
//             return f;
//         }


        /*
         * Compares the two values referenced by ref1 and ref2 for equality
         */
        internal bool compareRef(int ref1, int ref2)
        {
            if (ref1 == ref2)
            {
                return(true);
            }

            int top = LuaDLL.lua_gettop(L);

            LuaDLL.lua_getref(L, ref1);
            LuaDLL.lua_getref(L, ref2);
            int equal = LuaDLL.lua_equal(L, -1, -2);

            LuaDLL.lua_settop(L, top);
            return(equal != 0);
        }
Esempio n. 4
0
 public bool LuaEqual(int idx1, int idx2)
 {
     return(LuaDLL.lua_equal(L, idx1, idx2) != 0);
 }
Esempio n. 5
0
 public static bool lua_metatableequal(IntPtr luaState, int index, string metatable)
 {
     LuaDLL.lua_getmetatable(luaState, index);
     LuaDLL.lua_getglobal(luaState, metatable);
     return(LuaDLL.lua_equal(luaState, -1, -2) > 0 ? true : false);
 }