Jump to content




Line 434: attempt to index ? (a nil value) (only when it's doing files[4])


  • You cannot reply to this topic
10 replies to this topic

#1 mibac138

  • Members
  • 132 posts
  • LocationPoland

Posted 22 April 2013 - 08:03 AM

http://pastebin.com/77k1wQdA
Please help :C

#2 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 22 April 2013 - 09:36 AM

Did you ever think: it might be too many?..

Really, you have 412 lines of text you want to print. Hmm...

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 22 April 2013 - 09:43 AM

your for loop is wrong
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

View PostEngineer, on 22 April 2013 - 09:36 AM, said:

Really, you have 412 lines of text you want to print. Hmm...
Doesn't look like it is printing to me, looks like it is being saved to file...

Edited by theoriginalbit, 22 April 2013 - 09:52 AM.


#4 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 22 April 2013 - 09:56 AM

View Posttheoriginalbit, on 22 April 2013 - 09:43 AM, said:


View PostEngineer, on 22 April 2013 - 09:36 AM, said:

Really, you have 412 lines of text you want to print. Hmm...
Doesn't look like it is printing to me, looks like it is being saved to file...

*facepalms of stupidness from myself*
*walks away slowly...*

#5 mibac138

  • Members
  • 132 posts
  • LocationPoland

Posted 23 April 2013 - 01:19 AM

View Posttheoriginalbit, on 22 April 2013 - 09:43 AM, said:

your for loop is wrong
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

View PostEngineer, on 22 April 2013 - 09:36 AM, said:

Really, you have 412 lines of text you want to print. Hmm...
Doesn't look like it is printing to me, looks like it is being saved to file...

Ok, but what should i do now? I don't know how to repair it :C

#6 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 23 April 2013 - 01:26 AM

View Postmibac138, on 23 April 2013 - 01:19 AM, said:

Ok, but what should i do now? I don't know how to repair it :C
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.

#7 mibac138

  • Members
  • 132 posts
  • LocationPoland

Posted 23 April 2013 - 01:34 AM

Quote

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:

#8 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 23 April 2013 - 01:37 AM

create the folders '.main' and '.apis' first. I'd assume thats what the problem is, the directories don't exist.

#9 mibac138

  • Members
  • 132 posts
  • LocationPoland

Posted 23 April 2013 - 01:39 AM

They exists (they are created by "Step 1 (i=0))! and this is the problem :(

#10 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 23 April 2013 - 01: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

Edited by theoriginalbit, 23 April 2013 - 01:55 AM.


#11 mibac138

  • Members
  • 132 posts
  • LocationPoland

Posted 23 April 2013 - 01:59 AM

View Posttheoriginalbit, on 23 April 2013 - 01:51 AM, said:

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! ^_^





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users