Does anyone know the best way to terminate a lua script or macro?
I have been using "do return end", but I have run into a problem. If I run "do return end" from within a function it will end that function but not the entire macro script.
For example:
In a file called macrofunctions I could have the following:
function whatIwanttosay()
wx.wxmessagebox("good to see you")
do return end --end script so nothing else is said (this is what I was hoping I could use to stop the entire program)
end
function whatIamthinking()
wx.wxmessagebox("looks like you gained a few pounds")
end
My macro would be:
function m90001()
whatIwanttosay()
whatIamthinking()
end
The do return end at the end of the function whatIwanttosay() does nothing to prevent the macro from calling the next function. Is there a way to end an entire macro from within a function? If not, I am wondering what is considered best practice for ending a script.
I realize that I could have each function return a number and I could check for that number before running any further functions, but it doesn't seem like a very elegant solution. I have quite a few nested functions, and the whole thing becomes a mess if I have to query each one to see if it has completed before continuing.
Thanks for any help!!
David