Jump to content




Attempt to index ? (A boolean value)


  • You cannot reply to this topic
6 replies to this topic

#1 Inumel

  • Members
  • 120 posts

Posted 04 June 2013 - 07:04 PM

Hi! Me againsorry 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

#2 GopherAtl

  • Members
  • 888 posts

Posted 04 June 2013 - 07: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.

#3 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 04 June 2013 - 07: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.

#4 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 04 June 2013 - 07:21 PM

Please post the whole code.

#5 Inumel

  • Members
  • 120 posts

Posted 04 June 2013 - 07:25 PM

I am using a very slightly modified version of this program here, bottom most post
http://www.computerc...urtle-programs/
And this is the program as it is on my computer
http://pastebin.com/fyn09SuJ

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

#6 GopherAtl

  • Members
  • 888 posts

Posted 04 June 2013 - 07:30 PM

View PostElgriton, on 04 June 2013 - 07:25 PM, said:

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).

#7 Inumel

  • Members
  • 120 posts

Posted 04 June 2013 - 07:31 PM

View PostGopherAtl, on 04 June 2013 - 07:30 PM, said:

View PostElgriton, on 04 June 2013 - 07:25 PM, said:

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





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users