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

Cant Use Pastebin In An API?

Started by Zenon, 21 July 2015 - 01:59 AM
Zenon #1
Posted 21 July 2015 - 03:59 AM
Hi all! I decided to make an autoupdater, and figured it best to only make it one program. I also figured that I may aswell make it in my api so I dont have to have an entirely seperate program. The problem comes in when I do this:
SpoilerYou can see I was messing around a bit to try and narrow down the error

function updateCheck()
--shell.run("pastebin", "run", "GVZYhGTS")
--if enderdiceupdate == true then
  --shell.run("pastebin", "get", program.."link", "updatetest")
    shell.run("pastebin", "get", "KXRzGDcC", "updatecheck")
--end
end
Now, running this normally will work . . . Just not when I load it as an api. Anyone know how I would get that to work?

Note: It returns the error

attempt to index nil ? (a nil value)
And I can use other functions in my api, so it isnt that.
–Wont be on again until tomorrow so dont think Im ignoring you if you reply. Thanks in advance!
Edited on 21 July 2015 - 03:48 PM
H4X0RZ #2
Posted 21 July 2015 - 04:06 AM
Are you calling the function just as checkUpdate() outside the API or as APINAME.checkUpdate()?

–Derp. You said you can access other API functions…–

I think the shell API is not "exposed" to other APIs. Try using os.run maybe.
Edited on 21 July 2015 - 02:08 AM
Lyqyd #3
Posted 21 July 2015 - 05:01 AM
The shell "API" is an interface exposed to programs running under a shell instance, not an actual API that's available globally. For such a simple task, use http.get instead of os.run.
Zenon #4
Posted 21 July 2015 - 05:50 PM
Are you calling the function just as checkUpdate() outside the API or as APINAME.checkUpdate()?

–Derp. You said you can access other API functions…–

I think the shell API is not "exposed" to other APIs. Try using os.run maybe.
The shell "API" is an interface exposed to programs running under a shell instance, not an actual API that's available globally. For such a simple task, use http.get instead of os.run.

Thanks guys!

Edit: Heh. Thats way above my paygrade, Ill just use a seperate program until Im a little more into lua lol
Edited on 21 July 2015 - 04:15 PM