Beispiel #1
0
    static int set_callback(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIProgress             obj  = (UIProgress)o;
            UIProgress.LuaCallback arg0 = null;
            LuaTypes funcType2          = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (UIProgress.LuaCallback)ToLua.CheckObject(L, 2, typeof(UIProgress.LuaCallback));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(UIProgress.LuaCallback), func) as UIProgress.LuaCallback;
            }

            obj.callback = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index callback on a nil value" : e.Message));
        }
    }
Beispiel #2
0
    static int get_callback(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIProgress             obj = (UIProgress)o;
            UIProgress.LuaCallback ret = obj.callback;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index callback on a nil value" : e.Message));
        }
    }
Beispiel #3
0
    public static Delegate UIProgress_LuaCallback(LuaFunction func, LuaTable self, bool flag)
    {
        if (func == null)
        {
            UIProgress.LuaCallback fn = delegate(object param0) { };
            return(fn);
        }

        if (!flag)
        {
            UIProgress_LuaCallback_Event target = new UIProgress_LuaCallback_Event(func);
            UIProgress.LuaCallback       d      = target.Call;
            target.method = d.Method;
            return(d);
        }
        else
        {
            UIProgress_LuaCallback_Event target = new UIProgress_LuaCallback_Event(func, self);
            UIProgress.LuaCallback       d      = target.CallWithSelf;
            target.method = d.Method;
            return(d);
        }
    }