On 5/13/17 6:29 PM, Alex Tweedly via use-livecode wrote:

all initialisation would be done in the librarystack handler

that handler would also set a script-local variable to avoid repeated
initialisation

so something like

local sIHaveBeenInitialized
on librarystack
  if sIHaveBeenInitialized is empty then
    put the millisecs into sIHaveBeenInitialized
  else
     -- setup initial / default values, etc.
     ....
  end if
end librarystack

This is fine for subsequent usage of the library - however, it's not so
convenient while working on the library. The problem then is that any
changes made to the initialization won't take effect unless I either
manually unset this script-local, or exit / re-enter the IDE.

I thought about adding a reset handler, e.g.

on library_reset
   put empty int sIHaveBeenInitialized
   pass library_reset
end library_reset

which would give me a quick, safe and easy way to reset any (all)
libraries from the message box. But then I thought it felt like I was
rediscovering a wheel - so I thought I'd ask on here :-)

Is there another easier / better way to handle this ?

That's often what I do too. Calling a reset handler from the message box is pretty simple.

Or if the logic allows it, sometimes I add a check for the environment to the initialization handler. If the environment is "development" then I re-initialize.

--
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to