Jump to content




How to convert string to number?


  • You cannot reply to this topic
5 replies to this topic

#1 Konlab

  • Members
  • 595 posts
  • LocationKerbin

Posted 27 May 2014 - 12:15 PM

How to convert string to number?
please help me!

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 27 May 2014 - 02:32 PM

Did you not even google "Lua convert string to number"?

local num = tonumber(str)


#3 Agoldfish

  • Members
  • 451 posts
  • LocationSome Fish Bowl in Ohio.

Posted 27 May 2014 - 02:33 PM

Or from an input:
tonumber(read())

Edited by Agoldfish, 27 May 2014 - 02:38 PM.


#4 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 27 May 2014 - 02:36 PM

View PostAgoldfish, on 27 May 2014 - 02:33 PM, said:

Or from an input:
local derp = read(tonumber())
Or is it...
tonumber(read())
I haven't used it in a while.
...if you don't know... don't help...

it is the second one btw.

#5 Agoldfish

  • Members
  • 451 posts
  • LocationSome Fish Bowl in Ohio.

Posted 27 May 2014 - 02:37 PM

View Posttheoriginalbit, on 27 May 2014 - 02:36 PM, said:

View PostAgoldfish, on 27 May 2014 - 02:33 PM, said:

Or from an input:
local derp = read(tonumber())
Or is it...
tonumber(read())
I haven't used it in a while.
...if you don't know... don't help...

it is the second one btw.
Well I obviously did know, I got it right. :P

#6 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

Posted 27 May 2014 - 02:38 PM

Here's something that's really useful! Link
Spoiler

Edited by TheOddByte, 27 May 2014 - 02:38 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users