lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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
			dofile(main_open_dlg.value)
		else
			iup.Message("File does not exist!", main_open_dlg.value)
		end
	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
		end
	end
	
end
-- 
View this message in context: http://www.nabble.com/lua-%2B-iup-help-tf4455569.html#a12706641
Sent from the Lua - General mailing list archive at Nabble.com.