diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-03-20 09:54:08 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-03-20 09:54:08 -0300 |
| commit | 88c9bf99de50df5575cce13e8e6c278b9f1dc0d0 (patch) | |
| tree | 3cfe2080f0a2595b62b74752c84ffa763e83f8e6 /ltests.c | |
| parent | 63a614e1453b6b03b89b5d47efa476acd5f9d1d2 (diff) | |
| download | lua-88c9bf99de50df5575cce13e8e6c278b9f1dc0d0.tar.gz lua-88c9bf99de50df5575cce13e8e6c278b9f1dc0d0.tar.bz2 lua-88c9bf99de50df5575cce13e8e6c278b9f1dc0d0.zip | |
standard libraries in packages
Diffstat (limited to 'ltests.c')
| -rw-r--r-- | ltests.c | 14 |
1 files changed, 4 insertions, 10 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 1.111 2002/03/04 21:29:41 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.112 2002/03/14 18:01:52 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -666,7 +666,8 @@ static const struct luaL_reg tests_funcs[] = { | |||
| 666 | {"closestate", closestate}, | 666 | {"closestate", closestate}, |
| 667 | {"doremote", doremote}, | 667 | {"doremote", doremote}, |
| 668 | {"log2", log2_aux}, | 668 | {"log2", log2_aux}, |
| 669 | {"totalmem", mem_query} | 669 | {"totalmem", mem_query}, |
| 670 | {NULL, NULL} | ||
| 670 | }; | 671 | }; |
| 671 | 672 | ||
| 672 | 673 | ||
| @@ -681,14 +682,7 @@ static void fim (void) { | |||
| 681 | void luaB_opentests (lua_State *L) { | 682 | void luaB_opentests (lua_State *L) { |
| 682 | *cast(int **, L) = &islocked; /* init lock */ | 683 | *cast(int **, L) = &islocked; /* init lock */ |
| 683 | lua_state = L; /* keep first state to be opened */ | 684 | lua_state = L; /* keep first state to be opened */ |
| 684 | /* open lib in a new table */ | 685 | luaL_opennamedlib(L, "T", tests_funcs); |
| 685 | lua_newtable(L); | ||
| 686 | lua_getglobals(L); | ||
| 687 | lua_pushvalue(L, -2); | ||
| 688 | lua_setglobals(L); | ||
| 689 | luaL_openl(L, tests_funcs); /* open functions inside new table */ | ||
| 690 | lua_setglobals(L); /* restore old table of globals */ | ||
| 691 | lua_setglobal(L, "T"); /* set new table as global T */ | ||
| 692 | atexit(fim); | 686 | atexit(fim); |
| 693 | } | 687 | } |
| 694 | 688 | ||
