Is there a way to reset a script error in HALion using LUA code?
In my instrument, I occasionally get an annoying error message in the onNote callback. However, this error does not affect the functionality of my instrument. Is there a way to add a line of code within the onNote callback to automatically reset the script error if one occurs?
I don’t think there is a way to reset the script from the code itself. Ideally you should figure out what’s causing the error and prevent it from happening. What is the error message?
Hi, thanks for your help! This is the error I’m getting. It doesn’t happen all the time and seems to occur without any specific reason. However, my instrument appears to be working perfectly even when the error occurs:
onNote: No matching overload found, candidates:
luabind::object (Element&,lua_State*)
This is my onNote code:
function onNote(event)
local note = event.note
local velocity = event.velocity
local zone = this.parent:getZone(1)
local playbackPos = zone:getParameter("Amp Env.PlaybackPos")
heldNotes[note] = true
if LoopOnRelease then
if playbackPos == 0 then
noteIds[note] = nil
loopingNotes[note] = false
end
if noteIds[note] then
releaseVoice(noteIds[note])
noteIds[note] = nil
loopingNotes[note] = false
LayerIsPlaying = false
heldNotes[note] = nil
return
end
local noteId = playNoteWithSync(note, velocity)
if noteId then
noteIds[note] = noteId
loopingNotes[note] = true
if zone:getParameter("SampleOsc.SustainLoopModeA") == 0 then
watchEnd = true
end
updateButtonState()
end
else
if noteIds[note] then
releaseVoice(noteIds[note])
noteIds[note] = nil
end
local noteId = playNoteWithSync(note, velocity)
if noteId then
noteIds[note] = noteId
updateButtonState()
end
end
end
No idea yet. I did have a look but couldn’t reproduce the error with the example you posted. Did you manage to narrow it down a bit? Some parameters on or off when it happens? You have quite a few variables for notes and note ids and some other custom functions. Could be anything that’s called from or referenced from onNote.
My understanding is that no matching overload means you call some method and don’t provide required arguments.
Maybe @Philippe_Bono could help us understand the error message you’re getting.
HI @misohoza,
I have an important update: I’ve discovered that when a script error occurs, I can still play the loop associated with the affected layer. However, the layer does not synchronize with the host tempo. In my script, when the host is playing, the loop of the instrument starts in sync on the bar. When I encounter this error, that layer no longer starts on the bar, but I can still play it in “free” mode. It seems to me that Halion is receiving a nil value from the host tempo or something similar. The very strange thing is that this happens on very rare occasions and without any valid reason. Do you have any ideas on how to fix this?
Thanks for your suggestion! I tried it, and everything worked perfectly for three days. But today, out of the blue, I got the error again for no apparent reason—especially since I tested it for three days always using the same presets and samples!
At this point, I have no idea what’s causing it, so I think I’ll just move on. Maybe it’s some bizarre coincidence tied to my system—something almost impossible to reproduce.
Thanks again for your help! I really appreciate it.