Jump to content
Toggle menu
  • 17.3K articles
  • 8.2K files
  • 5 users
  • 280.7K edits
WoW Classic Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

API EditBox GetNumber

From WoW Classic Wiki
GetNumber -Documentation by DerGhulbus-
number = editBox:GetNumber()

If a number was entered, it returns a numerical value of the number. If anything else was entered (including nil) it returns 0.


Arguments

none


Returns
number
number
Number - corresponding to the number entered in the EditBox

Details

This function proves to be very useful when reading in numbers. While GetText() will return a string, which you can't perform any arithmetic operations or comparison with, this function converts the TextString to a number. This will even work for all strings that are considered as well formed numerical constants in lua (so it will work for '314.16e-2' too).

If you enter a string, or a hybrid like 'abc123def', the function returns 0.

If you enter a hybrid like 12abc34 the function will ignore everything after the last valid digit (thus returning 12 in the example)