This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Konlab's profile picture

How to convert string to number?

Started by Konlab, 27 May 2014 - 11:15 AM
Konlab #1
Posted 27 May 2014 - 01:15 PM
How to convert string to number?
please help me!
Lyqyd #2
Posted 27 May 2014 - 03:32 PM
Did you not even google "Lua convert string to number"?


local num = tonumber(str)
Agoldfish #3
Posted 27 May 2014 - 03:33 PM
Or from an input:

tonumber(read())
Edited on 27 May 2014 - 01:38 PM
theoriginalbit #4
Posted 27 May 2014 - 03:36 PM
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.
Agoldfish #5
Posted 27 May 2014 - 03:37 PM
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/>
TheOddByte #6
Posted 27 May 2014 - 03:38 PM
Here's something that's really useful! Link
SpoilerYes I know it's Google.. But please search before asking questions here..
Edited on 27 May 2014 - 01:38 PM