str.tonumber

The number written in the string ("1.5", " -2 ", "3e2"), or na when it is not a number. Spaces around the number are ignored.

str.tonumber(string: string) -> float

Parameters

Example

str.tonumber("4.25")