You need to handle the result returned by "multiChoice" function properly.
According to the function documentation, returned value is either nil (in case of dialog being cancelled), or a table in which selected keys contain value "true". Therefore, proper handling may look like this:
local choices = gg.multiChoice({'Option 1', 'Option 2'})
if choices == nil then
-- action if dialog has been cancelled
else
if choices[1] then
-- action if first option has been selected
end
if choices[2] then
-- action if first option has been selected
end
end
However, there may be tricky cases where one action prevents other action(s) from being executed. One of such cases is "goto" statement. Once it is executed, all other conditions won't be checked and therefore no actions will be executed. Consider the following example:
local choices = gg.multiChoice({'Option 1', 'Option 2'})
if choices == nil then
os.exit()
else
if choices[1] then
print('Option 1')
goto finish
end
if choices[2] then
print('Option 2')
end
end
::finish::
Here, if user selects both option 1 and option 2, only actions related to option 1 will be executed, because after executing "goto" statement script execution continues from the specified label, "finish" in this case.
Possible workaround here is to check the condition that represents option 1 being selected after all other conditions, so that other conditions will be checked first and related actions will or won't be executed depending on the result of each check. But this workaround can't be applied to the cases where there are "goto" statements in 2 or more blocks of actions related to different conditions. So don't use "goto" and there will be no need to deal with such problems. Use functions instead. There are quite little amount of cases where usage of "goto" is justified and your case is not one of them.