lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Still trying to do the "hello world"!

  extern "C" {
  #include "lua.h"
  }
  int main() {
     lua_State *L = lua_open(0);
     lua_dostring(L, "print(\"Hello World!\")");
     return 0;
  }

This code generates this message:

  error: attempt to call global 'print' (a nil value)

Any other function names besides "print" don't work also. Is there any
sort of "import" procedure to make a set of functions available?

P.S.: Anyone knows a good step-by-step quickstart tutorial on the basics
of embedding Lua ? If not, maybe I'll write a short one (that is, once I
learn it :-)

- Fabio