Jump to content

Spr243

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by Spr243

  1. Thank you again for your response. I really appreciate it.
  2. Thank you for your response. My actual intended use is for programming a bot in Discord, but I figured the general principle would be the same. I will be aware of the potential security implications, but this bot is private and limited in its use to trusted people. Ignoring security issues, what would be the way to do what I mentioned in my original post, as making switch statements for each would take tremendous amounts of effort for the goal I am trying to achieve.
  3. How can I run a method stored in a variable? For example, there is a dropdown of available methods and the selects a method that the user wants it to complete. That method is stored in the variable, userSelectedMethod. For the example, that method would be toUpperCase(). var userSelectedMethod = "toUpperCase()" I want the script to run the method that is in the variable and apply it to the enteredText variable. I tried using the following code. (Didn't work, obviously) /// Attempt 1 var newResult = enteredText.userSelectedMethod; /// Attempt 2 var newResult = enteredText.Module[userSelectedMethod]; /// Attempt 3 var newResult = enteredText.callback(userSelectedMethod); I want the newResult to run whatever method the user's selected method is. What would be the proper and simplest method of accomplishing this? Note: The variable names and extra steps that I had in my project, from which this question arose, have been removed and simplified to explain what I'm trying to do.
  4. How can I run a method stored in a variable? For example, the user selects a method that the user wants it to complete. That method is stuck in the variable, userSelectedMethod. var userSelectedMethod = "toUpperCase()" I want the script to run the method that is in the variable. I tried using the following code. (Didn't work, obviously) /// Attempt 1 var newResult = enteredText.userSelectedMethod; /// Attempt 2 var newResult = enteredText.Module[userSelectedMethod]; /// Attempt 3 var newResult = enteredText.callback(userSelectedMethod); I want the newResult to run whatever method the user Selected Method is. What would be the proper and simplest method of accomplishing this? Note: The variable names and extra steps have been removed and simplified to explain what I'm trying to do.
×
×
  • Create New...