mirror of https://github.com/rusefi/lua.git
back with an "open all libs" function
This commit is contained in:
parent
eab1965c05
commit
31f6540fba
33
linit.c
33
linit.c
|
@ -1,8 +1,37 @@
|
||||||
/*
|
/*
|
||||||
** $Id: linit.c,v 1.5 2000/06/16 17:22:43 roberto Exp roberto $
|
** $Id: linit.c,v 1.6 2000/08/09 14:50:13 roberto Exp roberto $
|
||||||
** Initialization of libraries for lua.c
|
** Initialization of libraries for lua.c
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
>>>>>>> This module is now obsolete, and is not part of Lua. <<<<<<<<<
|
|
||||||
|
#define linit_c
|
||||||
|
#define LUA_LIB
|
||||||
|
|
||||||
|
#include "lua.h"
|
||||||
|
|
||||||
|
#include "lualib.h"
|
||||||
|
#include "lauxlib.h"
|
||||||
|
|
||||||
|
|
||||||
|
static const luaL_reg lualibs[] = {
|
||||||
|
{"", luaopen_base},
|
||||||
|
{LUA_TABLIBNAME, luaopen_table},
|
||||||
|
{LUA_IOLIBNAME, luaopen_io},
|
||||||
|
{LUA_STRLIBNAME, luaopen_string},
|
||||||
|
{LUA_MATHLIBNAME, luaopen_math},
|
||||||
|
{LUA_DBLIBNAME, luaopen_debug},
|
||||||
|
{"", luaopen_loadlib},
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
LUALIB_API int luaopen_stdlibs (lua_State *L) {
|
||||||
|
const luaL_reg *lib = lualibs;
|
||||||
|
for (; lib->func; lib++) {
|
||||||
|
lib->func(L); /* open library */
|
||||||
|
lua_settop(L, 0); /* discard any results */
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
6
ltests.h
6
ltests.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: ltests.h,v 2.6 2004/06/02 19:09:21 roberto Exp roberto $
|
** $Id: ltests.h,v 2.7 2004/06/29 16:57:24 roberto Exp roberto $
|
||||||
** Internal Header for Debugging of the Lua Implementation
|
** Internal Header for Debugging of the Lua Implementation
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -70,8 +70,8 @@ extern int islocked;
|
||||||
|
|
||||||
int luaB_opentests (lua_State *L);
|
int luaB_opentests (lua_State *L);
|
||||||
|
|
||||||
#undef LUA_EXTRALIBS
|
#undef lua_userinit
|
||||||
#define LUA_EXTRALIBS { "tests", luaB_opentests },
|
#define lua_userinit(L) { luaopen_stdlibs(L); luaB_opentests(L); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
14
luaconf.h
14
luaconf.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: luaconf.h,v 1.7 2004/06/23 15:57:29 roberto Exp roberto $
|
** $Id: luaconf.h,v 1.8 2004/06/29 16:57:56 roberto Exp roberto $
|
||||||
** Configuration file for Lua
|
** Configuration file for Lua
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -84,9 +84,15 @@
|
||||||
#define PROGNAME "lua"
|
#define PROGNAME "lua"
|
||||||
|
|
||||||
|
|
||||||
#define LUA_EXTRALIBS /* empty */
|
/*
|
||||||
|
** this macro allows you to open other libraries when starting the
|
||||||
#define lua_userinit(L) openstdlibs(L)
|
** stand-alone interpreter
|
||||||
|
*/
|
||||||
|
#define lua_userinit(L) luaopen_stdlibs(L)
|
||||||
|
/*
|
||||||
|
** #define lua_userinit(L) { int luaopen_mylibs(lua_State *L); \
|
||||||
|
** luaopen_stdlibs(L); luaopen_mylibs(L); }
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
14
lualib.h
14
lualib.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lualib.h,v 1.29 2004/03/24 15:46:49 roberto Exp roberto $
|
** $Id: lualib.h,v 1.30 2004/05/28 18:35:05 roberto Exp roberto $
|
||||||
** Lua standard libraries
|
** Lua standard libraries
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -11,11 +11,6 @@
|
||||||
#include "lua.h"
|
#include "lua.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef LUALIB_API
|
|
||||||
#define LUALIB_API LUA_API
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Key to file-handle type */
|
/* Key to file-handle type */
|
||||||
#define LUA_FILEHANDLE "FILE*"
|
#define LUA_FILEHANDLE "FILE*"
|
||||||
|
|
||||||
|
@ -43,9 +38,8 @@ LUALIB_API int luaopen_debug (lua_State *L);
|
||||||
LUALIB_API int luaopen_loadlib (lua_State *L);
|
LUALIB_API int luaopen_loadlib (lua_State *L);
|
||||||
|
|
||||||
|
|
||||||
/* to help testing the libraries */
|
/* open all previous libraries */
|
||||||
#ifndef lua_assert
|
LUALIB_API int luaopen_stdlibs (lua_State *L);
|
||||||
#define lua_assert(c) /* empty */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue