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

Attempt To Index?

Started by jmarko, 24 July 2013 - 11:28 PM
jmarko #1
Posted 25 July 2013 - 01:28 AM
The computercraft is show an error:
test.lua:13: attempt to index ? (a nil value)
At line 13:

local obj1 = gameutils.loadSprite(
	shell.resolve(".").."/obj1.nfp", 4, 4)
Please help!
Kingdaro #2
Posted 25 July 2013 - 02:02 AM
Could be a number of things.

1. Did you load the "gameutils" API?
2. Do you have a variable named "shell"?
3. Does the file actually exist and is being referenced correctly?
jmarko #3
Posted 25 July 2013 - 02:07 AM
Could be a number of things.

1. Did you load the "gameutils" API?
2. Do you have a variable named "shell"?
3. Does the file actually exist and is being referenced correctly?
1.Yes i loaded
2.The shell.resolve is not a default command?
3.Yes the file is exist
Kingdaro #4
Posted 25 July 2013 - 02:48 AM
shell.resolve is default. It's just that, if you name one of your variables "shell", the entire shell API becomes unusable.


local shell = nil
shell.run('edit') --> attempt to index a nil value

What your error means is that you're trying to call a function from an API that doesn't exist, at least not inside your script.
jmarko #5
Posted 25 July 2013 - 04:53 AM
shell.resolve is default. It's just that, if you name one of your variables "shell", the entire shell API becomes unusable.


local shell = nil
shell.run('edit') --> attempt to index a nil value

What your error means is that you're trying to call a function from an API that doesn't exist, at least not inside your script.
The API (GameUtils) is worked perfect because i maked other things with gameutils.
albrat #6
Posted 25 July 2013 - 07:16 AM
could you post the entire code of test.lua please, or at least up to line 14 of your code.

As the error could be before this line and we cannot diagnose from just the line and error, we can only hazzard guesses :)/>