-2

This is in minecraft specifically so some of this code may not make sense.

when ran it says line 77 is calling a nil value

http://pastebin.com/RqWDpVqD

(sorry pastebin but the code is rather big for here)

Mischa
  • 1,303
  • 12
  • 24
  • 5
    -1: Welcome to Stack Overflow. If your "codes" are "rather big for here", then you should turn your code into a [Short, Self Contained, Correct (Compilable), Example](sscce.org), then post it here. – Nicol Bolas Jul 15 '12 at 00:57

1 Answers1

1

i don't see anywhere where you ever require a file that implements an 'http' table/userdatum, and you never declare http outside the scope of getHttpBody(), so http is a nil value. so you try to call function request() on variable http, which has yet to be defined.

it looks like you just forgot to require the necessary files.

Mike Corcoran
  • 14,072
  • 4
  • 37
  • 49
  • im new to lua so sorry if i am way off here. but would i just need "local http = require("socket.http")" then before the gethttpbody() function? – user1526264 Jul 17 '12 at 19:49
  • yeah, that should be all you need. most people generally put those at the very top of the script, so it's easier to know whats getting pulled in, and so those variables are defined before any other lua code might run that may depend on them. – Mike Corcoran Jul 17 '12 at 20:50