/src/linit.c

http://lvmextend.googlecode.com/ · C · 38 lines · 24 code · 9 blank · 5 comment · 1 complexity · 87c49be9d212f531933e19b8a8f4fc9b MD5 · raw file

  1. /*
  2. ** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $
  3. ** Initialization of libraries for lua.c
  4. ** See Copyright Notice in lua.h
  5. */
  6. #define linit_c
  7. #define LUA_LIB
  8. #include "lua.h"
  9. #include "lualib.h"
  10. #include "lauxlib.h"
  11. static const luaL_Reg lualibs[] = {
  12. {"", luaopen_base},
  13. {LUA_LOADLIBNAME, luaopen_package},
  14. {LUA_TABLIBNAME, luaopen_table},
  15. {LUA_IOLIBNAME, luaopen_io},
  16. {LUA_OSLIBNAME, luaopen_os},
  17. {LUA_STRLIBNAME, luaopen_string},
  18. {LUA_MATHLIBNAME, luaopen_math},
  19. {LUA_DBLIBNAME, luaopen_debug},
  20. {NULL, NULL}
  21. };
  22. LUALIB_API void luaL_openlibs (lua_State *L) {
  23. const luaL_Reg *lib = lualibs;
  24. for (; lib->func; lib++) {
  25. lua_pushcfunction(L, lib->func);
  26. lua_pushstring(L, lib->name);
  27. lua_call(L, 1, 0);
  28. }
  29. }