lualib.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. ** $Id: lualib.h $
  3. ** Lua standard libraries
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef lualib_h
  7. #define lualib_h
  8. #include "lua.h"
  9. /* version suffix for environment variable names */
  10. #define LUA_VERSUFFIX "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR
  11. #define LUA_GLIBK 1
  12. LUAMOD_API int (luaopen_base) (lua_State *L);
  13. #define LUA_LOADLIBNAME "package"
  14. #define LUA_LOADLIBK (LUA_GLIBK << 1)
  15. LUAMOD_API int (luaopen_package) (lua_State *L);
  16. #define LUA_COLIBNAME "coroutine"
  17. #define LUA_COLIBK (LUA_LOADLIBK << 1)
  18. LUAMOD_API int (luaopen_coroutine) (lua_State *L);
  19. #define LUA_DBLIBNAME "debug"
  20. #define LUA_DBLIBK (LUA_COLIBK << 1)
  21. LUAMOD_API int (luaopen_debug) (lua_State *L);
  22. #define LUA_IOLIBNAME "io"
  23. #define LUA_IOLIBK (LUA_DBLIBK << 1)
  24. LUAMOD_API int (luaopen_io) (lua_State *L);
  25. #define LUA_MATHLIBNAME "math"
  26. #define LUA_MATHLIBK (LUA_IOLIBK << 1)
  27. LUAMOD_API int (luaopen_math) (lua_State *L);
  28. #define LUA_OSLIBNAME "os"
  29. #define LUA_OSLIBK (LUA_MATHLIBK << 1)
  30. LUAMOD_API int (luaopen_os) (lua_State *L);
  31. #define LUA_STRLIBNAME "string"
  32. #define LUA_STRLIBK (LUA_OSLIBK << 1)
  33. LUAMOD_API int (luaopen_string) (lua_State *L);
  34. #define LUA_TABLIBNAME "table"
  35. #define LUA_TABLIBK (LUA_STRLIBK << 1)
  36. LUAMOD_API int (luaopen_table) (lua_State *L);
  37. #define LUA_UTF8LIBNAME "utf8"
  38. #define LUA_UTF8LIBK (LUA_TABLIBK << 1)
  39. LUAMOD_API int (luaopen_utf8) (lua_State *L);
  40. /* open selected libraries */
  41. LUALIB_API void (luaL_openselectedlibs) (lua_State *L, int load, int preload);
  42. /* open all libraries */
  43. #define luaL_openlibs(L) luaL_openselectedlibs(L, ~0, 0)
  44. #endif