Help: It's Lua or my stupidity

Started by garry23, August 28, 2018, 11:47:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

garry23

@a1ex or someone

Hope you can put me out of my misery.

I simply can't work out what is going on here:

                dual_on = false
                if menu.get("Expo","Dual ISO") == "OFF" then
                    -- do nothing
                else
                    dual_on = true
                    dual_menu = menu.get("Expo","Dual ISO")
                    menu.set("Expo","Dual ISO","OFF")
                end


All I'm trying to do is detect if Dual ISO is on and switch it off until my code has run.

But the above does nothing.

I then switch Dual back on with:

if dual_on then
                    dual_on = false
                    menu.set("Expo","Dual ISO",dual_menu)
                end


Where am I going wrong?[/s]

SOLVED = my stupidity  ;)

garry23

@a1ex

I'm 're-opening' this post as I'm still having difficulties associated with having four scripts running at the same time.

I think the issue may be related to the fact that each script is calling the keypress and shoot_task event handlers.

So my question is: can you indeed have different scripts calling these handlers? Or should I recode to have a single (master) event handler?

Hope you can educate me.

a1ex

It should work, but you can't exactly control which one executes first. IIRC the first one, alphabetically by file name, executes first; one of them might prevent the key events from reaching the other scripts. That's what I can imagine it can go wrong without seeing the scripts.

Even better - if you can prepare a minimal example, that would be easier to debug.

garry23

@a1ex

Thanks for the insight.

I'll play around a bit more and only 'bother' you again if I hit a brick wall.

Cheers

Garry