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

HELP error :23: '=' expected

Started by chezno12, 22 July 2012 - 09:17 PM
chezno12 #1
Posted 22 July 2012 - 11:17 PM
I'm very nooby at coding and whenever I try to run this code i get an error, but i didnt design the code and it seems to work for others. help? (code source: http://mccraftcpl.proboards.com/index.cgi?board=programsboard&action=display&thread=163 )


[left]side = "left"[/left]
[left]print ("Waiting for blank disk")[/left]
[left]while true do[/left]
[left]os.pullEvent()[/left]
[left]if disk.isPresent(side) then[/left]
[left]print ("Card Detected.")[/left]
[left]write ("What level is this card? >")[/left]
[left]input = read()[/left]
[left]disk.setLabel(side, "Level "..input.." Access card")[/left]
[left]file = io.open("disk/level", "w")[/left]
[left]file:write(input)[/left]
[left]file:close()[/left]
[left]print ("Disk has been altered.")[/left]
[left]sleep(1)[/left]
[left]print ("Please remove the disk")[/left]
[left]sleep(5)[/left]
[left]print ("Rebooting…")[/left]
[left]sleep(1)[/left]
[left]os.reboot()[/left]
[left]end[/left]
[left]end[/left]

[left]Read more:http://mccraftcpl.proboards.com/index.cgi?board=programsboard&action=display&thread=163#ixzz21OKI2Amb[/left]
Grim Reaper #2
Posted 22 July 2012 - 11:59 PM
From what I can tell right away, power isn't a recognized function in CC (correct me if I am wrong). Also, it appears that passt is a string and therefore you can't perform arithmetic in comparison, like checking if it's greater than or equal to. However, I'm not entirely sure that Lua doesn't allow arithmetic on strings.
MysticT #3
Posted 23 July 2012 - 12:06 AM
From what I can tell right away, power isn't a recognized function in CC (correct me if I am wrong). Also, it appears that passt is a string and therefore you can't perform arithmetic in comparison, like checking if it's greater than or equal to. However, I'm not entirely sure that Lua doesn't allow arithmetic on strings.
The variable power is set to the rs.setOutput function, so it calls that. Also, he's talikng about the other code :)/>/>.

It looks like you forgot the brackets after a function call (most probably os.reboot()), check that in your code.
Grim Reaper #4
Posted 23 July 2012 - 12:14 AM
From what I can tell right away, power isn't a recognized function in CC (correct me if I am wrong). Also, it appears that passt is a string and therefore you can't perform arithmetic in comparison, like checking if it's greater than or equal to. However, I'm not entirely sure that Lua doesn't allow arithmetic on strings.
The variable power is set to the rs.setOutput function, so it calls that. Also, he's talikng about the other code :)/>/>.

It looks like you forgot the brackets after a function call (most probably os.reboot()), check that in your code.

My bad :o/>/>