0

Trouble with simple Mu code for mode

I apologize in advance, I'm just getting started with Mu, so I'm sure I'm going to have a lot of very basic mistakes as I come up to speed. I'm trying to write a mode, and failing almost immediately. I'm attaching my code - it doesn't do much but try to initialize the mode and do some printing. Unfortunately, that's enough to trigger this error:

-----

ERROR: No match found for function "init" with 7 arguments: ml_slate_mode.MLSlatePopup, ml_slate_mode.MLSlatePopup, ml_slate_mode.MLSlatePopup, ml_slate_mode.MLSlatePopup, string, bool, bool

-----

Where are those 4 copies of my class coming from when I'm calling init()? I feel like this should be a pretty simple problem to debug, which makes me think that I'm misunderstanding something about the language on a pretty fundamental level. I was able to get my mode initializing correctly through python, but then was having other trouble using MuSymbol to run Mu code, so it's probably cleaner if I can just get everything running correctly in Mu.

Thanks!




ml_slate_overlay.mu

6 comments

  • 0
    Avatar
    José M. Calvo

    IMHO, If you are just starting, I would suggest that you use Python instead.

    Also, if I remember, somewhere in the reference manual says that Python is preferred over Mu. You can still access Mu from Python if needed.

    Chema

  • 0
    Avatar
    Aaron Wilson

    Great, I'd prefer to work in python if possible. So let me ask my python question, then. I can't get it to recognize a .mu module that I create. I'm attaching two files - the python one lives in .rv/Python and the mu lives in .rv/Mu. Here's the error I get when I hit the "/" key:

    ---

    <!--StartFragment-->ERROR: Could not find Mu symbol 'ml_slate.printMyMessage'
    Traceback (most recent call last):
    File "/la/Users/MAGICLEAP/awilson/.rv/Python/ml_slate_overlay.py", line 17, in toggle
    printMe = MuSymbol('ml_slate.printMyMessage')<!--EndFragment-->

    ---

    Do I have to manually tell it to load my .mu code somehow? I thought anything in .rv/Mu would be source upon launch.

  • 0
    Avatar
    Jon Morley

    Hi Aaron,

    Would it be possible for you to send me your complete package so I could test it exactly as you for myself in our test environment?

    Thanks,
    Jon

  • 0
    Avatar
    Jon Morley

    I forgot to say that I agree with José. We recommend the Python approach in most cases.

  • 0
    Avatar
    Aaron Wilson

    I don't actually have a package yet - I'm just getting started and the constant building of the package file seemed like it would slow things down, so I'm just putting the source files directly in my Mu and Python directories until I get to the point where I'm far enough along to make a package out of it.

    I think I read in the documentation that it should work using this method, but if it needs to be contained in the same package file to load my definition that would certainly explain it.

  • 0
    Avatar
    Jon Morley

    Hi Aaron,

    I am not totally sure what will happen if you don't have them in the same package, because load order will be uncontrolled. It is certainly best to make a package and then you can continue to work on the files in your personal workspace and then copy them over the files on your RV_SUPPORT_PATH and relaunch RV. Once you have made the package please send that to us if you are still having issues. Feel free to do that in a private ticket if you wish.

    Thanks,
    Jon

Please sign in to leave a comment.