ULX

Author Topic: integer and string input  (Read 1851 times)

0 Members and 1 Guest are viewing this topic.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
integer and string input
« on: May 12, 2013, 08:06:29 AM »
is it possible to have a user be able to input an integer only when a certain string is selected? so say the string is slay is it possible to have a integer input feild enabled for the user to add a value but when any other string is selected the input field is disabled?
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: integer and string input
« Reply #1 on: May 12, 2013, 08:27:10 AM »
In ULX?
http://ulyssesmod.net/docs/files/lua/ulib/shared/commands-lua.html#cmds.NumArg

As for determining it's optionality based on the previous input string, well, uh, I don't think so.
Megiddo and perhaps MrP/Stickly can weigh in on that.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: integer and string input
« Reply #2 on: May 13, 2013, 11:47:34 AM »
Yes, command arguments are static. Creating an API for dynamic arguments as you're suggesting would be a nightmare... *shudder*

You can enforce the dynamic aspect yourself by always taking it as a string argument.
Experiencing God's grace one day at a time.