Пример #1
0
    static int OnCompleteCallback(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            Util.Timer    obj       = (Util.Timer)ToLua.CheckObject(L, 1, typeof(Util.Timer));
            System.Action arg0      = null;
            LuaTypes      funcType2 = LuaDLL.lua_type(L, 2);

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

            Util.Timer o = obj.OnCompleteCallback(arg0);
            ToLua.PushObject(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }