linit.c
Go to the documentation of this file.
1 /*
2 ** $Id: linit.c $
3 ** Initialization of libraries for lua.c and other clients
4 ** See Copyright Notice in lua.h
5 */
6 
7 
8 #define linit_c
9 #define LUA_LIB
10 
11 /*
12 ** If you embed Lua in your program and need to open the standard
13 ** libraries, call luaL_openlibs in your program. If you need a
14 ** different set of libraries, copy this file to your project and edit
15 ** it to suit your needs.
16 **
17 ** You can also *preload* libraries, so that a later 'require' can
18 ** open the library, which is already linked to the application.
19 ** For that, do the following code:
20 **
21 ** luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE);
22 ** lua_pushcfunction(L, luaopen_modname);
23 ** lua_setfield(L, -2, modname);
24 ** lua_pop(L, 1); // remove PRELOAD table
25 */
26 
27 #include "lprefix.h"
28 
29 
30 #include <stddef.h>
31 
32 #include "lua.h"
33 
34 #include "lualib.h"
35 #include "lauxlib.h"
36 
37 
38 /*
39 ** these libs are loaded by lua.c and are readily available to any Lua
40 ** program
41 */
42 static const luaL_Reg loadedlibs[] = {
53  {NULL, NULL}
54 };
55 
56 
58  const luaL_Reg *lib;
59  /* "require" functions from 'loadedlibs' and set results to global table */
60  for (lib = loadedlibs; lib->func; lib++) {
61  luaL_requiref(L, lib->name, lib->func, 1);
62  lua_pop(L, 1); /* remove lib */
63  }
64 }
65 
loadedlibs
static const luaL_Reg loadedlibs[]
Definition: linit.c:42
luaopen_base
LUAMOD_API int luaopen_base(lua_State *L)
Definition: lbaselib.c:516
LUA_TABLIBNAME
#define LUA_TABLIBNAME
Definition: lualib.h:23
luaL_Reg
Definition: lauxlib.h:38
luaopen_utf8
LUAMOD_API int() luaopen_utf8(lua_State *L)
Definition: lutf8lib.c:283
LUA_GNAME
#define LUA_GNAME
Definition: lauxlib.h:20
LUA_OSLIBNAME
#define LUA_OSLIBNAME
Definition: lualib.h:29
lua_pop
#define lua_pop(L, n)
Definition: lua.h:365
luaopen_package
LUAMOD_API int luaopen_package(lua_State *L)
Definition: loadlib.c:739
luaopen_math
LUAMOD_API int luaopen_math(lua_State *L)
Definition: lmathlib.c:751
luaopen_debug
LUAMOD_API int luaopen_debug(lua_State *L)
Definition: ldblib.c:479
luaopen_table
LUAMOD_API int luaopen_table(lua_State *L)
Definition: ltablib.c:425
LUA_LOADLIBNAME
#define LUA_LOADLIBNAME
Definition: lualib.h:44
lua.h
LUA_COLIBNAME
#define LUA_COLIBNAME
Definition: lualib.h:20
LUA_UTF8LIBNAME
#define LUA_UTF8LIBNAME
Definition: lualib.h:35
LUA_DBLIBNAME
#define LUA_DBLIBNAME
Definition: lualib.h:41
luaopen_io
LUAMOD_API int luaopen_io(lua_State *L)
Definition: liolib.c:819
luaL_openlibs
LUALIB_API void luaL_openlibs(lua_State *L)
Definition: linit.c:57
lprefix.h
sol::lib
lib
Definition: sol.hpp:7809
lua_State
Definition: lstate.h:304
luaopen_os
LUAMOD_API int luaopen_os(lua_State *L)
Definition: loslib.c:426
luaopen_string
LUAMOD_API int luaopen_string(lua_State *L)
Definition: lstrlib.c:1812
lauxlib.h
lualib.h
LUA_MATHLIBNAME
#define LUA_MATHLIBNAME
Definition: lualib.h:38
LUA_STRLIBNAME
#define LUA_STRLIBNAME
Definition: lualib.h:32
luaopen_coroutine
LUAMOD_API int luaopen_coroutine(lua_State *L)
Definition: lcorolib.c:206
LUA_IOLIBNAME
#define LUA_IOLIBNAME
Definition: lualib.h:26
luaL_requiref
LUALIB_API void luaL_requiref(lua_State *L, const char *modname, lua_CFunction openf, int glb)
Definition: lauxlib.c:967
LUALIB_API
#define LUALIB_API
Definition: luaconf.h:290


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:44