title: attempt to call global `print' (a nil value)
body: <p>I have the following C file:</p>
  
  <pre><code>//thing.c
  #include &lt;lua.h&gt;
  #include &lt;lauxlib.h&gt;
  #include &lt;lualib.h&gt;
  
  #include &lt;stdio.h&gt;
  
  lua_State* L;
  
  int main(){
          L = lua_open();
  
          lua_dostring(L, "print(\"lua\")");
          printf("hello\n");
  
          return 0; }
  </code></pre>
  
  <p>and the following makefile:</p>
  
  <pre><code>default:
          gcc -I/usr/include/lua50 -L/usr/lib -o qwerty thing.c -llua50 -llualib50
  </code></pre>
  
  <p>the code builds just fine, but when I run it I get the following:</p>
  
  <pre><code>[string "print("lua")"]:1: attempt to call global `print' (a nil value)
  hello
  </code></pre>
  
  <p><strong>Note</strong>: I have seen the many other questions on this error, but they all deal with working directly in Lua, as opposed to with the C api.  They also seem to imply that the problem is that the <code>print</code> function was never defined.  I don't understand this, as I can run both a lua interpreter and a lua script just fine directly from the command line.</p>
  
  <p><strong>EDIT</strong>: I am using lua 5.0</p>