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

settings:55: attempt to call boolean

Started by koenkoe, 27 April 2014 - 06:46 PM
koenkoe #1
Posted 27 April 2014 - 08:46 PM
Here is my code: http://pastebin.com/4RjfNm15

Error message:
settings:55: attempt to call boolean
Line whith error:
newu = read()
Dayrider10 #2
Posted 27 April 2014 - 10:55 PM
Couple of questions. What are you typing into the username field? And why are you making a separate file for everything. Suppose you want to add multiple users on this computer. Put it into one file. Also why are you calling the settings function after you input everything. Take out the first settings function of where the error is and tell me how that works out.
Bomb Bloke #3
Posted 28 April 2014 - 01:24 AM
The short answer is "reboot the computer and try it again".

The long answer is that when a script runs, the variables it uses aren't discarded from memory when it's done, unless you specifically flag them as "local" to the script.

The function names you type in - eg "read()" - are themselves variables. Sticking the brackets after a variable name tells Lua to call it as a function.

If you at some point (either in this script or in another one) do this:

read = true

… then it's no longer possible to use "read()", as "read" is no longer a function that can be called, but a boolean set to true.

Rebooting a computer sets all default functions back to their original state.
koenkoe #4
Posted 28 April 2014 - 01:08 PM
That worked, thank you.