Don't execute a function if a routine is called outside the program - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Don't execute a function if a routine is called outside the program (/thread-4287.html) |
Don't execute a function if a routine is called outside the program - salvomic - 07-03-2015 03:20 PM hi, there is a way to don't execute a command if a function is not called inside the program, but externally (EXPORT...)? I've a code like this one: Code:
I would like to execute changeData(); only if ascendant() is called inside a program (to return to its menu, and so on) but not when the function is called externally (passing parameters...). In other words: the function should ask itself: "who is calling?"... Thank you Salvo RE: Don't execute a function if a routine is called outside the program - roadrunner - 07-03-2015 06:22 PM Salvo, If I understand your question correctly, this should work: Code:
When you execute ascendant from the Home screen, changedata is not executed. When calling_program executes ascendant the flag "a" is set to 1 first and changedata is executed. You can't set "a" to 1 externally if you make it local. I don't know if the prime has user flags like the 48 thru 50g series has or not. I'm still learning HPPPL. Cheers, Road RE: Don't execute a function if a routine is called outside the program - salvomic - 07-03-2015 06:27 PM (07-03-2015 06:22 PM)roadrunner Wrote: Salvo, thanks Road, I'll try it; it seems a good workaround. Never I know if the Prime has user flags. I'll let you know then. Salvo EDIT: It worked, but I had to define a variable as global (internalfun:=0) to pass values through the routines... |