lua-users home
lua-l archive

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


2007/4/8, Cody Harris <charris@vectec.net>:
extern "C"
{
 #include "lua.h"
 #include "lauxlib.h"
 #include "lualib.h"
}

int _tmain(int argc, _TCHAR* argv[])
{
      lua_State* luaVM ;
      luaVM = lua_open();

      lua_baselibopen(luaVM);
      lua_strlibopen(luaVM);
      lua_mathlibopen(luaVM);

In 5.x the functions to load standard libraries are named that way :
luaopen_base, luaopen_package, luaopen_table, luaopen_io, luaopen_os,
luaopen_string, luaopen_math, luaopen_debug.

Also with Lua 5.1 you shouldn't call them directly but instead push
them on the stack (with lua_pushcfunction) and then call them (with
lua_call/lua_pcall).

If you're using an older version someone else will have to guide you.