0

I've created multiple items within a sub menu, making it a dynamic sub menu. I however don't know any way in order to differentiate between the different items once they've been clicked. Anyone got any ideas?

warSubMenu.addItem(chosenMenu,'loadLoadout(' + chosenMenu +')');

Above is the code I've used in order to create the sub menu. I've tried to pass an argument through the function loadLoadout() however .addItem() believes the the function to be entirely separate rather than an argument being passed into loadLoadout().

Galaxy
  • 9
  • 3
  • Welcome to [so]. Please add a [mcve] including if you plan to share this spreadsheet and how the function that creates the menu will be called. Also add the textual error message. – Rubén Jan 11 '23 at 21:07
  • By the way, also you should add a brief description of your search efforts as is suggested in [ask]. Related questions: https://stackoverflow.com/q/31539911/1595451, https://stackoverflow.com/q/64383424/1595451 – Rubén Jan 11 '23 at 21:15
  • 1
    You can execute functions by function name. So you can build a dynamic menu in html based upon a select tag selected item's name – Cooper Jan 11 '23 at 21:23
  • the ui menu methods do not support arguments atm, you need to think of some work arounds. – Ping Jan 12 '23 at 02:59

1 Answers1

1

The problem is that script is passing a string that is not a valid function name. A function name should not contain parenthesis.

Reference

Related

Rubén
  • 34,714
  • 9
  • 70
  • 166