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

What Is Wrong With This

Started by trey2k, 02 September 2013 - 01:03 PM
trey2k #1
Posted 02 September 2013 - 03:03 PM
i made a program called safe delete but it dose not work and i cant seem to find the problem

me = yes you = no
term.setCursorPos(1,1)
term.clear()
print("Are You Sure")
print("yes or no?")
input = read()
if input == "me" then
local tArgs = { ... }
if #tArgs < 1 then
	   print( "usage: rm <path>" )
	   return
end
end

local sNewPath = shell.redolve( tArgs[1] )
print("file deleted")
sleep(1)
term.clear()

if input == "you" then
print("Delete Canceld")
sleep(1)
term.clear()
end
and ik i fail at spelling
and the error code is :16: attempt to index ? (a nil value)
theoriginalbit #2
Posted 02 September 2013 - 03:13 PM
it's not shell.redolve, try `shell.resolve` instead.

your print after that line wont work, you're not starting or finishing the string, and you're also not finishing the function call. surround `file deleted` with quotes and add a ) to the end.
trey2k #3
Posted 02 September 2013 - 05:23 PM
it's not shell.redolve, try `shell.resolve` instead.

your print after that line wont work, you're not starting or finishing the string, and you're also not finishing the function call. surround `file deleted` with quotes and add a ) to the end.
thanks
trey2k #4
Posted 02 September 2013 - 05:26 PM
it's not shell.redolve, try `shell.resolve` instead.

your print after that line wont work, you're not starting or finishing the string, and you're also not finishing the function call. surround `file deleted` with quotes and add a ) to the end.
thanks
wait that was a typo it is like that in the real program
H4X0RZ #5
Posted 02 September 2013 - 05:33 PM
The top of the program won't work.
You try to give "me" the value of the variable "yes" but "yes" is nil. The same for "you"
trey2k #6
Posted 02 September 2013 - 05:44 PM
The top of the program won't work.
You try to give "me" the value of the variable "yes" but "yes" is nil. The same for "you"
ok what do i need to do to fix that
H4X0RZ #7
Posted 02 September 2013 - 06:33 PM

me = "yes"
you = "no"
When you remove the "s at your if statements it should work fine
theoriginalbit #8
Posted 02 September 2013 - 06:36 PM
Still won't work as intended though. Take a look at your if statements for checking the input. Id provide more info, but I'm on my phone.
trey2k #9
Posted 02 September 2013 - 07:03 PM

me = "yes"
you = "no"
When you remove the "s at your if statements it should work fine
that still did not work
H4X0RZ #10
Posted 02 September 2013 - 07:12 PM

me = "yes"
you = "no"
When you remove the "s at your if statements it should work fine
that still did not work
what is the error you get?
trey2k #11
Posted 02 September 2013 - 07:36 PM

me = "yes"
you = "no"
When you remove the "s at your if statements it should work fine
that still did not work
what is the error you get?
same error
theoriginalbit #12
Posted 02 September 2013 - 07:48 PM
same error
can you please put your code onto pastebin so that we can see the exact code you have and not a retype into this thread.
trey2k #13
Posted 02 September 2013 - 07:56 PM
same error
can you please put your code onto pastebin so that we can see the exact code you have and not a retype into this thread.
its on a server so i cant do that
theoriginalbit #14
Posted 02 September 2013 - 08:23 PM
its on a server so i cant do that
well look at line 16 (there is a counter on the bottom right) and please make sure you type it character for character here.
H4X0RZ #15
Posted 03 September 2013 - 08:52 AM

me = "yes"
you = "no"
When you remove the "s at your if statements it should work fine
that still did not work
what is the error you get?
same error

look at this:
it's not shell.redolve, try `shell.resolve` instead.

your print after that line wont work, you're not starting or finishing the string, and you're also not finishing the function call. surround `file deleted` with quotes and add a ) to the end.