Jump to content




Attempt to call nil on this program


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

#1 gknova61

  • Members
  • 74 posts

Posted 27 November 2012 - 08:10 PM

Idk what's wrong with this, it says attempt to call nil on line 17
http://pastebin.com/tjzbPDf2

This is happening on every program that uses this function or the code of it even this one :( http://pastebin.com/XR9C8z75 Currently the code is commented out for that program but just find "if not fs.exists" and it should be the first piece of commented out code that comes up that isn't working ;)

#2 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 27 November 2012 - 08:28 PM

Is http enabled on your computercraft? If not, enable it and try again.

#3 gknova61

  • Members
  • 74 posts

Posted 27 November 2012 - 09:16 PM

Yup, it's enabled on the emulator. Still attempt to call nil on line 26. It gets a response, it just has a problem with fs.

EDIT: BONUS!!! I got a problem with this program too, attempt to call nil :(
http://pastebin.com/zqvjshdA

<3 u :D

#4 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 28 November 2012 - 03:59 AM

on that second code you have something to check if http is not nilm if it is nil you print something and use return. return does not work in a program, you should use
error( "Pastebin requires the HTTP API\nSet enableAPI_http to 1 in mod_ComputerCraft.cfg" )
to cancel effectively or your code will keep running

#5 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 28 November 2012 - 04:29 AM

View PostKaoS, on 28 November 2012 - 03:59 AM, said:

on that second code you have something to check if http is not nilm if it is nil you print something and use return. return does not work in a program, you should use
error( "Pastebin requires the HTTP API\nSet enableAPI_http to 1 in mod_ComputerCraft.cfg" )
to cancel effectively or your code will keep running
Actually, return works just fine. There are examples of it working in several of the default programs with CC. One being the pastebin program. Instead of throwing an error, it just prints, then exits the program.
For it having error on line 26, that may be that your shell.resolve is not working like you need it to. Try doing shell.resolve("/"..path). I don't know if that would work, but that's what Kaos and I did when we were working on the file system for SmartPaste.

#6 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 28 November 2012 - 04:31 AM

:mellow: I am now officially freaked out... return working outside of a function...

#7 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 28 November 2012 - 04:34 AM

View Postgknova61, on 27 November 2012 - 09:16 PM, said:

EDIT: BONUS!!! I got a problem with this program too, attempt to call nil :(
http://pastebin.com/zqvjshdA
For the error on that one, you call "if pastebinGet(pastebinIds[i],fileName[i]) then", when it should be "if pastebinGet(pastebinIds[i],fileNames[i]) then". You forgot the "s" in fileNames

View PostKaoS, on 28 November 2012 - 04:31 AM, said:

:mellow: I am now officially freaked out... return working outside of a function...
Whatever you do... DON'T FREAK OUT.

#8 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 28 November 2012 - 06:17 AM

View PostKaoS, on 28 November 2012 - 04:31 AM, said:

:mellow:/> I am now officially freaked out... return working outside of a function...

Why should this be surprising? Programs are loadstring()'d and run as functions in os.run(), so of course return works to exit the function. :)

#9 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 28 November 2012 - 06:36 AM

AHHHH that explains it I guess, I just didn't realize. I think there was something contradictory in the 5.1 reference manual

#10 gknova61

  • Members
  • 74 posts

Posted 28 November 2012 - 02:33 PM

View PostCranium, on 28 November 2012 - 04:34 AM, said:

View Postgknova61, on 27 November 2012 - 09:16 PM, said:

EDIT: BONUS!!! I got a problem with this program too, attempt to call nil :(
http://pastebin.com/zqvjshdA
For the error on that one, you call "if pastebinGet(pastebinIds[i],fileName[i]) then", when it should be "if pastebinGet(pastebinIds[i],fileNames[i]) then". You forgot the "s" in fileNames

Works perfect, thanks cran :3 but can anyone solve this one? :) http://pastebin.com/tjzbPDf2
Attempt to call nil on line 26 for those who don't wana test it :P

EDIT: This is happening on every program that uses this function or the code of it even this one :( http://pastebin.com/XR9C8z75 Currently the code is commented out for that program but just find "if not fs.exists" and it should be the first piece of commented out code that comes up that isn't working ;)

#11 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 28 November 2012 - 06:59 PM

had to change your config to work with only config in stead of apis/config, because if limitations to writing to ROM. Also, line 249 did not specify multiple arguments in config.load().

GPS Tower:
Spoiler

Config:
Spoiler

You now have another error in your config file regarding table index expected, got nil on line 63. Hope that helps...





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users