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

Attempt to compare number with string

Started by FancyBa5tardo, 11 August 2013 - 10:04 AM
FancyBa5tardo #1
Posted 11 August 2013 - 12:04 PM
I have gotin that same error a couple of times now and instead at the end i have "attempt to compare number with string expected, got string" would "local tArgs = tonumber({…})" work to fix that error
Bubba #2
Posted 11 August 2013 - 12:37 PM
Hello FancyBa5stardo,

If you could please post in the "New members needing to ask questions, please read" topic the next time you have a question that would be great. Thanks!

As for your error, if you would please post the code that you're using that would be great. Otherwise we have no way to know what you're doing wrong!
campicus #3
Posted 12 August 2013 - 09:56 PM
At a guess, you have declared a variable and it is behaving as a string:


local var = tArg[1]

use this instead:


local var = tonumber(tArg[1])

However, we have no way of knowing without your code