[Lua][Error] attempt to index ? (a nil value)
I'm trying my hand at getting a turtle to build a structure for me - once I've got it working I'm going to use it to build a base under the surface of lava. Unfortunately, I keep getting that error. Here's a link to pastebin - I've imported it directly to the turtle using the pastebin command. And yes, it's defintiely a turtle not a computer.
http://pastebin.com/VvVPPhMF
2
[Lua][Error] attempt to index ? (a nil value)
Started by Heliomance, Feb 02 2013 06:41 AM
12 replies to this topic
#1
Posted 02 February 2013 - 06:41 AM
#2
Posted 02 February 2013 - 06:46 AM
do sleep(0.1) instead of sleep 0.1
that should fix it
that should fix it
#3
Posted 02 February 2013 - 07:10 AM
Nope, still giving exactly the same error.
New file (I only just made a pastebin account): http://pastebin.com/S1HwYeRt
New file (I only just made a pastebin account): http://pastebin.com/S1HwYeRt
#4
Posted 02 February 2013 - 09:52 AM
Can you at least tell us which line?!
#5
Posted 02 February 2013 - 11:27 AM
Heliomance, on 02 February 2013 - 07:10 AM, said:
Nope, still giving exactly the same error.
New file (I only just made a pastebin account): http://pastebin.com/S1HwYeRt
New file (I only just made a pastebin account): http://pastebin.com/S1HwYeRt
Using this code I get no errors. Try rebooting minecraft (server and client). Sometimes things get jumbled up in there.
#6
Posted 02 February 2013 - 11:06 PM
you should get a error [number] attempt to index a nul value what is the number if possible could you please tell then maybe people can help more as opposed to trying to look through the whole code to find the error.
#7
Posted 02 February 2013 - 11:22 PM
unless you are setting turtle.right to turtle.turnRight ( as well as the lefts ) then that would be the biggest problem
#8
Posted 03 February 2013 - 12:15 AM
Your whole program is wrapped in a function but the function is never called, How are you executing the program?
#9
Posted 03 February 2013 - 01:20 AM
remiX, on 02 February 2013 - 09:52 AM, said:
Can you at least tell us which line?!
BlackDragon, on 03 February 2013 - 12:15 AM, said:
Your whole program is wrapped in a function but the function is never called, How are you executing the program?
>pastebin get S1HwYeRt basetest >lua >basetest.buildBase()
#10
Posted 03 February 2013 - 01:27 AM
you need to do os.loadAPI("basetest") first before using it as an API.
#11
Posted 03 February 2013 - 03:48 AM
What exactly is an API, and how are you supposed to run programs if that's not it?
#12
Posted 03 February 2013 - 06:21 AM
An API is not meant to be the main program. An API is a program but, it ONLY contains functions for future use when you load it from another program.
People would use it to make their main program 'neater' if the functions within the API are not needed to be edited to suit the programs needs.
Example:
Make a program and call it 'myAPI' in the computers main folder.
Open it and add this to it:
Now you main program have this:
Output:
Now it called the functions from the API and ran it.
People would use it to make their main program 'neater' if the functions within the API are not needed to be edited to suit the programs needs.
Example:
Make a program and call it 'myAPI' in the computers main folder.
Open it and add this to it:
function hello() print("Hello there! Do i know you?") end
Now you main program have this:
os.loadAPI("myAPI") print("Line") myAPI.hello() print("You should know me :(/>")
Output:
Line Hello there! Do i know you? You show know me :(/>
Now it called the functions from the API and ran it.
#13
Posted 03 February 2013 - 07:09 AM
So I should take out the function wrapper, and then just calling basetest will work?
Yep, that worked. Thanks for the help, all!
Yep, that worked. Thanks for the help, all!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users