NodeMCU external callback function generates error
<p>I am using NodeMCU 0.9.6 with an Adafruit HUZZAH ESP8266.</p>

<p>The following code, which defines the callback function within the <code>http.get</code> statement, works:</p>

<pre><code>    http.get("http://192.168.2.38/ICmd.py?i=esp8266001", nil, function(code, data)
    if (code &lt; 0) then
      print("***ICmd HTTP request failed")
    else
      print("***ICmd callback: ", code, data)
    end
  end)
</code></pre>

<p>The following code moves the callback function definition from within the <code>http.get</code> statement to be a standalone function:</p>

<pre><code>function chkICmdResp(code, data)
    if (code &lt; 0) then
      print("***ICmd HTTP request failed")
    else
      print("***ICmd callback: ", code, data)
    end
end

http.get("http://192.168.2.38/ICmd.py?i=esp8266001", nil, chkICmdResp(code, data) )
</code></pre>

<p>The second format does not work, it generates the error: </p>

<pre><code>stdin:2: attempt to compare nil with number
stack traceback:
    stdin:2: in function 'chkICmdResponse'
    stdin:1: in main chunk
</code></pre>

<p>Am I doing something incorrectly (NodeMCU noobie)?  Or is this a design feature or a bug?</p>

<p>It would be nice to be able to have a single callback function that can be referenced from multiple http.get calls.</p>

<p>Note: I have also tried this with the <code>net.socket:on("receive",...)</code> module and got the same error result when trying to use a function that is defined outside of the calling statement.</p>