2 posts
Posted 15 August 2016 - 10:49 PM
I tried to do something like a stupid GUI for CC and while debugging I got this error:
window:179: bad argument: string expected, got nil
Press any key to continue
I press a random key and then the computer shuts down :-(
PROGRAM:
http://pastebin.com/BNEDzDMgCC Version: 1.79
Please, don't tell me it's a stupid project, I already know.
Thank you :)/>
218 posts
Location
tmpim
Posted 16 August 2016 - 02:31 AM
You store the color information as string literals, then try to set the background/text color with said string literal. Do one of the following:
local desktopbar = {
" ",
colors.black,
colors.white
}
Or you could do something like this:
local desktopbar = {
" ",
"black",
"white"
}
-- So use the code you are already using
-- But when you set the colors, do this
term.setBackgroundColor( colors[ name[2] ] )
term.setTextColor( colors[ name[3] ] )
2 posts
Posted 16 August 2016 - 11:57 AM
You store the color information as string literals, then try to set the background/text color with said string literal. Do one of the following:
local desktopbar = {
" ",
colors.black,
colors.white
}
Or you could do something like this:
local desktopbar = {
" ",
"black",
"white"
}
-- So use the code you are already using
-- But when you set the colors, do this
term.setBackgroundColor( colors[ name[2] ] )
term.setTextColor( colors[ name[3] ] )
Oh, thank you!
I didn't remember that, the last time I used computercraft was back in 2014!