Home › Forums › General › Programming › [resolved]win build 1500 setValue issue (bug?)
- This topic has 13 replies, 2 voices, and was last updated 10 years, 9 months ago by Hecticcc.
-
AuthorPosts
-
July 19, 2013 at 11:34 pm #10986
In the panel i am working on i get errors with setValue() in build 1500, in 1449 i have no problems & all works as it should.
Error i get is
lua runtime error At line[-1]:[C] What:C Namewhat: method Name: setValue Error message: No matching overload found, candidates: void setValue(CtrlrModulator&,int,bool,bool)
- This topic was modified 10 years, 9 months ago by Hecticcc. Reason: resolved
July 19, 2013 at 11:47 pm #10987setValue takes 2 boolean values, i’m sure you used to have 3, this all changed but your old setModulatorValue() calls should be fine, only the setValue() calls are different.
The two boolean values are
1. force – to force a change trigger even if the previous value was the same
2. mute – controls MIDI outputJuly 19, 2013 at 11:47 pm #10988When in doubt always have a look at:
https://sourceforge.net/p/ctrlrv4/code/1503/tree/nightly/Source/Lua/CtrlrLuaModulator.cppand the magic what() method in the console
July 19, 2013 at 11:55 pm #10991Thanks Atom, i found the offending scripts & modifying them now 🙂
Could it be that a few revs ago setValue only took one bool? I had them setup that way in the scripts that produced this error and they worked until now.
Cheerz,
HecJuly 19, 2013 at 11:58 pm #10993Well it did take one but a long time ago, it’s possible. I saw people using setModulatorValue() so i left that unchanged, i think i’ll bring back setValue() with one bool so that no more errors pop up.
July 20, 2013 at 12:04 am #10994Mmmh, changing all to setValue(somevar,bool,bool) still gives the same error. I then changed them to the “old” way, setModulatorValur(x, bool,bool,bool) and this works again.
Moral of the story – imme stick to the old way for now 🙂
July 20, 2013 at 12:04 am #10995Please show me the exact code, it might be a type mismatch between int/bool.
July 20, 2013 at 12:05 am #10998Simultane posting – always good for a laugh!
Yeah, if it does not break anything please do, less typing 🙂
July 20, 2013 at 12:13 am #11000First fetch some midi data and trigger other functions when needed:
midiReceived = function(midi)
ID = midi:getLuaData():getByte(7)
LS = midi:getLuaData():getByte(9)
MS = midi:getLuaData():getByte(10)
......
....
...
if ID == 44 then setSamplezoneRoot(LS,MS) end....
end
And then the “helper” function, this produces the errors:
function setSamplezoneRoot(x,y)
local rootnote = panel:getModulatorByName("sampleZoneRootNote")
rootnote:setValue(LS,false,true)end
July 20, 2013 at 12:17 am #11001Ok i don’t know if i get it, you define LS in one method, and pass it to setSamplezoneRoot() as parameters named x and y but you never use that you use LS in that method, this will work almost always but the ALMOST is a big problem. The LS variable might be used uninitialized and passed in as “nil” and this will cause problems, it has to be int (nil is a special type)
July 20, 2013 at 12:24 am #11002Lol i did not even spot this one!
I think i wrote this one in a sleepy moment, the other (similar) functions i wrote use the correct variables.Thanks Atom!
July 20, 2013 at 12:27 am #11003Yah, nil values have had me doing some funny stuff along the way. If it’s supposed to be an int value i force it to be 0 in the script that needs the value and then Lua is happy again – and me too 🙂
July 20, 2013 at 12:29 am #11004Well like i said you got lucky here, because ALL variables in Lua are global by default (unless declared local). But you should pay attention to the scope of your variables.
Also i recommend picking a naming scheme for your variables. If you keep them all caps it suggests constants for other developers, i try to sitck to lowercase notation, it’s an abbrevation of the hungarian notation: http://en.wikipedia.org/wiki/Hungarian_notation
i leave the type part, lua has no types. What i’m saying is, pick a method and stick to it.July 20, 2013 at 12:56 am #11006I just name the globals in caps to keep track of them 🙂
Thanks for the link, will keep it in mind for the future. -
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.