Not a perfect solution, but until you have something more elaborate: make the menu point A, B and C... and ask to enter A, B or C appended with (), for example: B(). This is like ad-hoc invoking the function B() on the Espruino board. Before showing the menu, define the A(), B() and C() ... functions (body) and delete them after menu input... (Instead of define and delete, assign A, B and C to and existing empty function, before the menu you assign them the desired existing functions, and afterwards you re-assign them again to the empty function.) That's the least intrusive option.
You can make the both flag/state controlled, so you do not have to setup and tear down for every menu.
I like the idea with having A(), B(), C() function names.
© Espruino, powered by microcosm.
Report a problem