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

fs. file? help.

Started by Goof, 25 November 2012 - 08:23 AM
Goof #1
Posted 25 November 2012 - 09:23 AM
Can someone help me with my error at the FS api?

code:
http://pastebin.com/huQQYWLc

thanks in advance


edit: error is : MikkAPI:414:attempt to call nil
dissy #2
Posted 25 November 2012 - 09:24 AM
What is the error you are getting?
billysback #3
Posted 25 November 2012 - 09:24 AM
What line does the error appear on?

Edit:
@ninja
the error is the name of the paste
Goof #4
Posted 25 November 2012 - 09:26 AM
The name of the paste?
billysback #5
Posted 25 November 2012 - 09:45 AM
Yes, but it should say
programname:line attempted to call Nil?
Goof #6
Posted 25 November 2012 - 09:58 AM
Its a API ?
billysback #7
Posted 25 November 2012 - 10:15 AM
then it will be
apiname:line etc.
there should be a number in the error, just tell me that number!
dissy #8
Posted 25 November 2012 - 10:19 AM
then it will be apiname:line etc. there should be a number in the error, just tell me that number!

It looks like he silently edited his original post with the error and didn't mention it to anyone.

edit: error is : MikkAPI:414:attempt to call nil

I'm not familiar with that API at all, so I can not help. Sorry.
billysback #9
Posted 25 November 2012 - 10:26 AM
@OP
Wait, why did you just repost this

@dissy the code he supplied IS the API…
Goof #10
Posted 25 November 2012 - 10:35 AM
Its a api i made myself, but this "PassServer" is the only thing that does not work, in the fs systems… Thats my real problem… But. I have tried a lot of new things, but nothing works… Thanks for quick response! Anyway
cmurtheepic #11
Posted 25 November 2012 - 11:09 AM
you've set it to find the directory local it should not have local their cuase you are telling it to look for the file within the program its self
cmurtheepic #12
Posted 25 November 2012 - 11:10 AM
like here


					    if not fs.exists("PdsWaid") then
							    fileCheck = fs.open("PdsWaid", "w")
									    for i, k in ipairs(Passwords) do
											    fileCheck.writeLine(Passwords[k])
									    end
							    fileCheck.close()	 
					    elseif fs.exists("PdsWaid") then
							    local fileRead = fs.open("PdsWaid", "r")

look at filecheck then at fileread it should not have a local and it can't have a local
Goof #13
Posted 25 November 2012 - 11:42 AM
I will try that ASAP thanks :-D
ChunLing #14
Posted 26 November 2012 - 08:19 AM
Put some debugging prints around the area, because I'm pretty sure the error is not actually line 414 in the posted script.
Goof #15
Posted 26 November 2012 - 10:23 AM
ChunLing. You have right.. I tested it with making some emptty lines, and it still says 414 . But its still hard to think, what i've done wrong.
ChunLing #16
Posted 26 November 2012 - 02:12 PM
You might be posting the bios line rather than the script line. It doesn't look like that's what you're doing, but it's hard to explain how the error line could be staying the same despite you changing the line counts before the error line.
Goof #17
Posted 26 November 2012 - 10:03 PM
But can you try to explain that?

thanks
ChunLing #18
Posted 27 November 2012 - 12:09 AM
I can't explain how the error line could possibly be the same after changing the line counts, no.

However, it's possible that the file getting run isn't the file that you've edited. If you have more than one copy of MikkAPI on the computer you're using to test it, then the one that got loaded last should be the one that you're editing.
Goof #19
Posted 27 November 2012 - 02:38 AM
Okay..

But i only have 1 MikkAPI, and thats for ccemu
so i really dont know whats wrong. But can you then give a example, based on your code? (Like you will make a new PassServer, and then if that works?)

thanks…
ChunLing #20
Posted 29 November 2012 - 07:49 AM
Sorry, I've been sick the last couple of days.

Looking over the PassServer function, there are a few substantial oddities and some problems. Most significant is that you don't end the function. You reset Passwords and IDS to empty tables on calling this function, and I doubt that's desired behavior. You've stored and replaced os.pullEvent as though you were going to restore it later, but you don't.