Jump to content




[Lua] [Error] Http Api


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

#1 Justy

  • Members
  • 210 posts
  • LocationCLGD

Posted 12 April 2012 - 02:12 AM

So, I am trying to create a program that gets the http from http://www.tiny.cc/lolosver but i keep getting a "attempt to index ? (a nil value)"
anyone know how? Thanks if you can.

#2 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 12 April 2012 - 02:14 AM

Code? Hard to find whats wrong without it.


Read this... http://www.computerc...faster-read-me/

#3 djblocksaway

    Epic Coderz

  • New Members
  • 397 posts
  • LocationAustralia

Posted 12 April 2012 - 07:35 AM

yeah we cant really help you if there is no code to look at (the only thing we can really do is tell u what the error means!?)

#4 Kolpa

  • New Members
  • 260 posts
  • LocationGermany

Posted 12 April 2012 - 11:11 AM

well what u can do is the following thing :P/>

local file = http.get("http://www.tiny.cc/lolosver")
local ver = file:readAll()

the var ver shoud be all the webpage content :D/>

but i dont know if tiny.cc is the problem :)/>

#5 Mads

  • Members
  • 604 posts
  • LocationCopenhagen, Denmark

Posted 12 April 2012 - 11:50 AM

You probably don't have the http API on. go to .minecraftconfigmod_ComputerCraft.cfg, and change "enableAPI_http=0" to "enableAPI_http=1"

#6 Justy

  • Members
  • 210 posts
  • LocationCLGD

Posted 12 April 2012 - 10:22 PM

Http API Enabled And What I Wanted Was A Explanation Of How It Works. Like Kolpa Did.
EDIT: @Kolpa Using That Code And Adding Only print(ver) I still get test:1:Attempt to index ? (a nil value)

#7 Kolpa

  • New Members
  • 260 posts
  • LocationGermany

Posted 13 April 2012 - 06:28 PM

well like i said try to not use the tiny.cc link use the real one so like this:
local file = http.get("http://dl.dropbox.com/u/50273341/version.http")
local ver = file:readAll()
or rename it to .html
:P/>

#8 kamnxt

  • New Members
  • 80 posts

Posted 13 April 2012 - 08:35 PM

View PostKolpa, on 13 April 2012 - 06:28 PM, said:

well like i said try to not use the tiny.cc link use the real one so like this:
local file = http.get("http://dl.dropbox.com/u/50273341/version.http")
local ver = file:readAll()
or rename it to .html
:P/>
Or txt :D/>

#9 Kolpa

  • New Members
  • 260 posts
  • LocationGermany

Posted 13 April 2012 - 09:30 PM

View Postkamnxt, on 13 April 2012 - 08:35 PM, said:

View PostKolpa, on 13 April 2012 - 06:28 PM, said:

well like i said try to not use the tiny.cc link use the real one so like this:
local file = http.get("http://dl.dropbox.com/u/50273341/version.http")
local ver = file:readAll()
or rename it to .html
:P/>
Or txt :D/>
well i dont now cuz its made for reading websites so i thought html woud be better :)/>

#10 kamnxt

  • New Members
  • 80 posts

Posted 14 April 2012 - 08:22 AM

View PostKolpa, on 13 April 2012 - 09:30 PM, said:

View Postkamnxt, on 13 April 2012 - 08:35 PM, said:

View PostKolpa, on 13 April 2012 - 06:28 PM, said:

well like i said try to not use the tiny.cc link use the real one so like this:
local file = http.get("http://dl.dropbox.com/u/50273341/version.http")
local ver = file:readAll()
or rename it to .html
:P/>
Or txt :D/>
well i dont now cuz its made for reading websites so i thought html woud be better :)/>
Well... I got it to read txts from my website and DCPU16 specifications from 0x10c. :)/>

#11 Kolpa

  • New Members
  • 260 posts
  • LocationGermany

Posted 14 April 2012 - 11:45 AM

View Postkamnxt, on 14 April 2012 - 08:22 AM, said:

View PostKolpa, on 13 April 2012 - 09:30 PM, said:

View Postkamnxt, on 13 April 2012 - 08:35 PM, said:

View PostKolpa, on 13 April 2012 - 06:28 PM, said:

well like i said try to not use the tiny.cc link use the real one so like this:
local file = http.get("http://dl.dropbox.com/u/50273341/version.http")
local ver = file:readAll()
or rename it to .html
:)/>
Or txt :)/>
well i dont now cuz its made for reading websites so i thought html woud be better :)/>
Well... I got it to read txts from my website and DCPU16 specifications from 0x10c. :)/>

well then :)/>

View PostKolpa, on 13 April 2012 - 06:28 PM, said:

well like i said try to not use the tiny.cc link use the real one so like this:
local file = http.get("http://dl.dropbox.com/u/50273341/version.http")
local ver = file:readAll()
or rename it to .html
:)/>
btw woudnt use dropox for this cuz u cant change the file with the link

#12 Kolpa

  • New Members
  • 260 posts
  • LocationGermany

Posted 14 April 2012 - 11:50 AM

i can code u a php/mysql db ver tool and give u some webspace if u want :)/>
local file = http.get("http://mastersofarms.no-ip.org/ver.php")
local ver = file:readAll() print(ver)
gonna code a vb ver changer and pm it to u if interested :)/>
okay all set pm me and u get it :)/>
and yes it works :)/> tested

Edited by Kolpa, 14 April 2012 - 12:45 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users