How to convert a string to a numeric value?

Q

How to convert a string to a numeric value?

A

Use the string.byte() operator.

Example Code:

string.byte(”a”) -- will result a numeric value 97
string.byte(”abcde”,2) –- will result a numeric value 98 (”b”)
string.byte(”abcde”,-1) –- will result a numeric value 101 (”e”)