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

fs table does not contain definition for exsists function

Started by TheMadHatter, 12 September 2016 - 12:21 PM
TheMadHatter #1
Posted 12 September 2016 - 02:21 PM
I started this script below in which I wanted to alter file content. When I put in my first check if the file exists, it threw out of the blue the "a attempt to call nill" error. I am clueless what the problem seems to be.

I modified the script to gather more information and look it prints the exists function, but later when I try to access it directly it is nill again?

I rebooted the CC computer in the hope it is a corrupted table, but with no success. (Also tried restarting minecraft)
(Vanilla CraftOS 1.7)


The script….

arguments = {...}
print(#arguments)
blrup = {}
references = {}
if arguments ~= nil and #arguments > 0 then
for k,v in pairs(fs) do
  print(" ",k, "-", v)
  fs[k]=v
  blrup[k] = v
  if references[v] then
   error("reference found twice" , k)
  end
  references[v] = true
end

if( arguments[1] and string.lower(arguments[1]) == "register" and arguments[2] and fs["exsists"](arguments[2])) then
  print("Service registered - %s", arguments[2])
elseif arguments[1] and string.lower(arguments[1]) == "register" then
  printError("Please use Service register [PATH]")
  print("Is fs nil? ", fs == nil)
  print("Is fs.exsists nil? ", fs.exsists == nil and fs["exsists"] == nil and blrup["exsists"] == nil)
  print(fs.exsists("/test"))
end
end

I hope you guys can spot any issues?
Edited on 12 September 2016 - 02:12 PM
Dog #2
Posted 12 September 2016 - 04:38 PM
In several places in your script you have fs.exsists (note the extra 's') instead of fs.exists.
TheMadHatter #3
Posted 12 September 2016 - 05:04 PM
Hahaha damn it typos get me quite a lot. I am crap without a propper auto complete ^^

Thanks man :)/>
Anavrins #4
Posted 12 September 2016 - 05:13 PM
When stuff like this happens, you should always consider typing error…
In fact, in your screenshot, you can clearly see that "exist" exists…
TheMadHatter #5
Posted 12 September 2016 - 05:15 PM
When stuff like this happens, you should always consider typing error…
In fact, in your screenshot, you can clearly see that "exist" exists…

I read it a couple of times and tought I typed it correctly… don't know why :P/>