Author Topic: Help: It's Lua or my stupidity  (Read 732 times)

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1716
Help: It's Lua or my stupidity
« on: August 28, 2018, 11:47:42 PM »
@a1ex or someone

Hope you can put me out of my misery.

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

Code: [Select]
                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:

Code: [Select]
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

  • Contributor
  • Hero Member
  • *****
  • Posts: 1716
Re: Help: It's Lua or my stupidity
« Reply #1 on: August 30, 2018, 09:16:44 PM »
@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

  • Administrator
  • Hero Member
  • *****
  • Posts: 12198
  • Maintenance mode
Re: Help: It's Lua or my stupidity
« Reply #2 on: August 30, 2018, 10:14:02 PM »
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

  • Contributor
  • Hero Member
  • *****
  • Posts: 1716
Re: Help: It's Lua or my stupidity
« Reply #3 on: August 30, 2018, 10:59:36 PM »
@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