Please help :C
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Line 434: attempt to index ? (a nil value) (only when it's doing files[4])
Started by mibac138, 22 April 2013 - 07:03 AMPosted 22 April 2013 - 09:03 AM
http://pastebin.com/77k1wQdA
Please help :C
Please help :C
Posted 22 April 2013 - 10:36 AM
Did you ever think: it might be too many?..
Really, you have 412 lines of text you want to print. Hmm…
Really, you have 412 lines of text you want to print. Hmm…
Posted 22 April 2013 - 10:43 AM
your for loop is wrong
EDIT 2: Ok time for a suggestion… add this code between 433 and 434…
for i=0,#files do
in Lua table indexes start at 1 so it should be
for i = 1, #files do
EDIT: Nvm just saw the if i ~= 0 then, although what is the point, just make the change I suggested.EDIT 2: Ok time for a suggestion… add this code between 433 and 434…
if not file then
print('Here is the problem... This file: '..tostring(files[i].dir)..' could not be opened for write')
end
Doesn't look like it is printing to me, looks like it is being saved to file…Really, you have 412 lines of text you want to print. Hmm…
Edited on 22 April 2013 - 08:52 AM
Posted 22 April 2013 - 10:56 AM
Doesn't look like it is printing to me, looks like it is being saved to file…Really, you have 412 lines of text you want to print. Hmm…
*facepalms of stupidness from myself*
*walks away slowly…*
Posted 23 April 2013 - 02:19 AM
your for loop is wrongin Lua table indexes start at 1 so it should befor i=0,#files do
EDIT: Nvm just saw the if i ~= 0 then, although what is the point, just make the change I suggested.for i = 1, #files do
EDIT 2: Ok time for a suggestion… add this code between 433 and 434…if not file then print('Here is the problem... This file: '..tostring(files[i].dir)..' could not be opened for write') end
Doesn't look like it is printing to me, looks like it is being saved to file…Really, you have 412 lines of text you want to print. Hmm…
Ok, but what should i do now? I don't know how to repair it :C
Posted 23 April 2013 - 02:26 AM
Well whichever file it was that couldn't be opened try different name or location, there has to be a reason why it cannot be created.Ok, but what should i do now? I don't know how to repair it :C
Posted 23 April 2013 - 02:34 AM
Well whichever file it was that couldn't be opened try different name or location, there has to be a reason why it cannot be created.
Ok, I tested it and saved the API to file "testing" and it's works but how can I fix that I can't save it to ".main/.apis/.OS"? :huh:/>
Posted 23 April 2013 - 02:37 AM
create the folders '.main' and '.apis' first. I'd assume thats what the problem is, the directories don't exist.
Posted 23 April 2013 - 02:39 AM
They exists (they are created by "Step 1 (i=0))! and this is the problem :(/>
Posted 23 April 2013 - 02:51 AM
try making them with fs.makeDir instead of the shell.run
short of that, I'm not too sure, I'll investigate some more
EDIT: ok this is the problem ".main/.programs/.apis/.OS" there is not .apis folder in the .programs folder
short of that, I'm not too sure, I'll investigate some more
EDIT: ok this is the problem ".main/.programs/.apis/.OS" there is not .apis folder in the .programs folder
Edited on 23 April 2013 - 12:55 AM
Posted 23 April 2013 - 02:59 AM
try making them with fs.makeDir instead of the shell.run
short of that, I'm not too sure, I'll investigate some more
EDIT: ok this is the problem ".main/.programs/.apis/.OS" there is not .apis folder in the .programs folder
Oh, thank you very much! It's should be ".main/.apis/.OS" instead of ".main/.programs/.apis/.OS" really thank you very much! ^_^/>