Magic Lantern Forum

Developing Magic Lantern => Scripting Corner => Scripting Q&A => Topic started by: garry23 on July 11, 2016, 06:43:23 PM

Title: Lua Menu Question
Post by: garry23 on July 11, 2016, 06:43:23 PM
@David

I've convinced myself that the Lua set.menu only works with numbers. Thus this is OK:

menu.set("Auto Bracketing","Focus bracketing?",0)

But this is not:

menu.set("Auto Bracketing","Focus bracketing?","No")

Because when I use the second format, the script freezes.

Am I correct?

BTW that menu is set up with a choices call and if I use 0 or, say, 2, it works but always goes to the first entry in choices.

Cheers

Garry
Title: Re: Lua Menu Question
Post by: dmilligan on July 11, 2016, 10:15:21 PM
It should work, but I suppose there could be issues if you are trying to use menu.set() to set the value of your own script's menu items. Instead of doing it like that, just set the "value" property of the menu object your script created.

If that's not it, can you be more specific than "the script freezes"? What sort of stuff is printed to the console?
Title: Re: Lua Menu Question
Post by: garry23 on July 11, 2016, 10:41:46 PM
David

You are a star.

That was it, I was menu.set in a warning function in a menu. Just changing to this.value approach solved the issue.

The freeze BTW occurred after I had gone into a sub menu, the freeze was that the Q button failed to return the sub menu to the parent.

Thanks, once again, for your prompt support. :)

Cheers

Garry