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

list:19: attempt to index ? (a function value)

Started by darkhenmore, 22 September 2012 - 08:26 AM
darkhenmore #1
Posted 22 September 2012 - 10:26 AM
i have written lots of programs recently so i dont know which one is causing the error but now when i do "dir" or "ls" it says:

list:19: attempt to index ? (a function value)

what do i need to do to fix it?
ardera #2
Posted 22 September 2012 - 12:18 PM
Can we see the code?
Luanub #3
Posted 22 September 2012 - 02:15 PM
Do you have a global var for a table named tDirs or a string named sItem in any of your programs? What about functions with those names??

list line 19 is:

table.insert( tDirs, sItem )

If not, the best thing to do, which should have probably been done to start with is to go through and make sure all of the functions/vars are local.

Without more information its going to be hard to help any further.
MysticT #4
Posted 22 September 2012 - 06:20 PM
You probably have a global function named table. Rename it and it should work, but it would be better to not use global variables and functions.
SgtElis #5
Posted 05 February 2013 - 08:54 AM
I got this problem as well! Have you figured it out? Could someone help me too? I have posted a thread wit my code here: http://www.computercraft.info/forums2/index.php?/topic/10209-e-craft60-attempt-to-index-a-function-value/
GopherAtl #6
Posted 05 February 2013 - 09:33 AM
same error but completely different problem, sgtelis. I applaud you for searching for similar problems before, but there is no need to necrobump old threads like this if they don't have an answer to your question.

Also, I'd already answered your question while you were searching, before you bumped this :)/>