Is there a way to turn words into numbers, and if there is, how?
Thanks
[QUESTION] How to turn words into numbers
Started by anonimo182, Oct 27 2012 07:32 PM
7 replies to this topic
#1
Posted 27 October 2012 - 07:32 PM
#2
Posted 27 October 2012 - 07:33 PM
If you mean turning "one" into 1, you'd need a lookup table. If you mean turning "1" into 1, you need tonumber().
#3
Posted 27 October 2012 - 07:38 PM
but like "hello" into 4986
#4
Posted 27 October 2012 - 07:40 PM
Also, there is something called coercion. Coercion in Lua basicly implies a type change during things like (addition | subtraction | division | multiplication).
EX:
> =( 1 + '1' + "1" )
3
(EDIT:
Seems like the forums didn't alert me to a new post...)
EX:
> =( 1 + '1' + "1" )
3
(EDIT:
Seems like the forums didn't alert me to a new post...)
Edited by Watcher7, 27 October 2012 - 07:42 PM.
#5
Posted 27 October 2012 - 07:42 PM
hello into 4986? why would that make sense?
#6
Posted 27 October 2012 - 07:45 PM
just an example
/>
#7
Posted 27 October 2012 - 07:46 PM
Do you want each word to become a random number?
#8
Posted 28 October 2012 - 11:36 AM
http://lua-users.org...LibraryTutorial try that one, string.byte should help you.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











