This iup button callback pauses execution of the calling plugin, hides the interface, passes control to the called script, and resumes when the called script closes.
Code: Select all
function btnCall:action()
dialog:hide()
dofile(fhGetContextInfo('CI_APP_DATA_FOLDER') .. '\\Plugins\\Demo.fh_lua')
dialog:show()
iup.Message('Call test', 'Done!')
end
Code: Select all
require('iuplua')
iup.SetGlobal('CUSTOMQUITMESSAGE','YES')
iup.Message('Message Demo', 'This plugin is being called from another plugin.')
I've got a couple of examples of self-contained plugins that perform well-defined tasks where it would be useful to call them from another plugin, rather than copy all the code and have to maintain multiple copies if there are changes.
The last time this was discussed , the discussion seemed to suggest that even this limited calling wasn't possible. I don't want to get into the complexity of creating modules or libraries, but are there any general rules on where dofile() is appropriate and what its limitations are? It clearly works up to a point, but I couldn't find anything on the forum or KB.