Search code examples
luaiup

(Lua/IUP) Check if one function is done before executing the next function


I have 2 functions. A function that displays a dialog that allows the user to choose which string to extract, and a function that can extract strings according to what the user chose in the dialog.

I want them to run one after another inside the open file function. Before this, having the extract function only makes it all work. But with the addition of the first function, now I have to ask the function to wait for the dialog in another before it can execute its function.

What happened is that it just goes through all the functions without actually waiting on their results. This resulted in the values being nil because the function was not even finished yet. So now I'm trying to find a way for the program to wait on the results, before continuing the program, either in IUP or in Lua.

How do you check to make sure that one function is finished before the other function can continue, especially if the first function happens to be a IUP dialog?

Here's the link to the sample code, with the first and second functions in use, and they are called within a function which is responsible for opening files.

https://controlc.com/906426ce

Thanks in advance


Solution

  • Welp. I'm dumb. Someone suggested to just get the functions from the main function used for opening files, before placing them into their separate functions. This resulted in the program just needing to call only one function, and everything just happens according to order.

    Thanks to that other guy who tried to solve my problem.