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