lua + iup help

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

lua + iup help

I'm using FreeBasic to make a lua script interpreter, and dynamically linking to iup with iuplua51.dll and iuplua51controls.dll. The way I have it now, when you start the interpreter it automatically loads a script called "main.lua"

The default main.lua that I will be packaging with the interpreter uses iup.filedlg to let the user select a lua script, which will the be run with dofile. This by itself works fine, however if I try to run any of the demo lua scripts from the iup package, although they do run and display the demo dialogs, the scripts immediately exit back to the main.lua script which pops up the open file dialog again. At this point, although the dialog created by the demo script is still on screen, it can't be interacted with at all. I tried adding a couple different types of loops to pause the script, but although adding them to the demo scripts kept them from returning back to main, I'm still unable to interact with the dialog created by the demo.

Can anyone tell me how to run a loop and still be able to use the created dialog?

Here's the script I'm using for main.lua:

main_loop = true

main_open_dlg = iup.filedlg{dialogtype = "OPEN", title = "Run Lua Script",
                      filter = "*.lua", filterinfo = "Lua Scripts",
                      directory=exepath().."\\scripts", nochangedir = "NO"}

while main_loop do
        main_open_dlg:popup (iup.CENTER, iup.CENTER)

        if main_open_dlg.status == "0" then
                if main_open_dlg.fileexist == "YES" then
                        iup.Message("File does not exist!", main_open_dlg.value)
        elseif main_open_dlg.status == "-1" then
                local main_quit = iup.Alarm("FB Lua", "No script selected, exit interpreter?" ,"Yes" ,"No")
                if main_quit == 1 then
                        main_loop = false