WoW:API EditBox GetNumber: Difference between revisions
Jump to navigation
Jump to search
GetNumber -Documentation by DerGhulbus-
No edit summary |
({{widgetmethod}}) |
||
Line 1: | Line 1: | ||
{{widgetmethod}} | |||
<center>'''GetNumber''' ''-Documentation by DerGhulbus-''</center> | <center>'''GetNumber''' ''-Documentation by DerGhulbus-''</center> | ||
Line 23: | Line 25: | ||
If you enter a hybrid like 12abc34 the function will ignore everything after the last valid digit (thus returning 12 in the example) | If you enter a hybrid like 12abc34 the function will ignore everything after the last valid digit (thus returning 12 in the example) | ||
Revision as of 11:47, 10 June 2006
← Widget API ← EditBox < GetNumber
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)