115 posts
Posted 04 June 2013 - 08:04 PM
Hi! Me again
sorry I am trying to do the following
x = rs.getInput("top")
But I am getting the error attempt to index ? (a boolean value)
I am not sure what I am doing wrong.. I could have sworn I have used this very code before :s
Any help, of course is appreciated, sorry for being such a dumb :P/>
871 posts
Posted 04 June 2013 - 08:16 PM
seeing your whole program would make it easier to identify the problem and help, but "attempt to index ?" means you tried to treat something that isn't a table (in this case, a boolean value) as a table, either with [] or "." If the error is indeed on that line, and not the previous line (which can and does happen sometimes), then somewhere you've overwritten "rs" with a boolean value.
7083 posts
Location
Tasmania (AU)
Posted 04 June 2013 - 08:16 PM
Seems to me you're misinterpreting the number of the line that's triggering the error. That code is fine, but the code around it may not be - bear in mind that statements can exceed one line in length.
8543 posts
Posted 04 June 2013 - 08:21 PM
Please post the whole code.
115 posts
Posted 04 June 2013 - 08:25 PM
I am using a very slightly modified version of this program here, bottom most post
http://www.computercraft.info/forums2/index.php?/topic/9996-melee-turtle-programs/And this is the program as it is on my computer
http://pastebin.com/fyn09SuJBut when I run lua and try to just do x = rs.getInput("top"), I still get the error, even when no other code is entered
871 posts
Posted 04 June 2013 - 08:30 PM
But when I run lua and try to just do x = rs.getInput("top"), I still get the error, even when no other code is entered
reboot the computer and then try that in lua, should work then. Overwriting globals like rs has effects beyond the program running, it's not like just blocking access to rs with a local variable. It may be an earlier version of the program, or even a completely different program, causing the error.
And if the program still errors after a reboot, give us the exact error message, including the context (filename and line number).
115 posts
Posted 04 June 2013 - 08:31 PM
But when I run lua and try to just do x = rs.getInput("top"), I still get the error, even when no other code is entered
reboot the computer and then try that in lua, should work then. Overwriting globals like rs has effects beyond the program running, it's not like just blocking access to rs with a local variable. It may be an earlier version of the program, or even a completely different program, causing the error.
And if the program still errors after a reboot, give us the exact error message, including the context (filename and line number).
This worked wonders, I should have tried that first.. thank you