aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-14 11:09:31 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-14 11:09:31 -0300
commit620d22f2a09ccfe5b7a09ebc11a7b5dca28ac9e4 (patch)
treee0a789478ca78f601d4fc05b62feddb978914a65 /ltests.c
parentf45cba42b5c32758337f62c56e98fdb85a9f4af2 (diff)
downloadlua-620d22f2a09ccfe5b7a09ebc11a7b5dca28ac9e4.tar.gz
lua-620d22f2a09ccfe5b7a09ebc11a7b5dca28ac9e4.tar.bz2
lua-620d22f2a09ccfe5b7a09ebc11a7b5dca28ac9e4.zip
new API function lua_rawget
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/ltests.c b/ltests.c
index 60079ce3..04cd1b40 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 1.40 2000/09/05 19:33:32 roberto Exp roberto $ 2** $Id: ltests.c,v 1.41 2000/09/11 19:42:57 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*/
@@ -25,6 +25,7 @@
25#include "lstring.h" 25#include "lstring.h"
26#include "ltable.h" 26#include "ltable.h"
27#include "luadebug.h" 27#include "luadebug.h"
28#include "lualib.h"
28 29
29 30
30void luaB_opentests (lua_State *L); 31void luaB_opentests (lua_State *L);
@@ -275,6 +276,19 @@ static int newstate (lua_State *L) {
275 return 1; 276 return 1;
276} 277}
277 278
279static int loadlib (lua_State *L) {
280 lua_State *L1 = (lua_State *)lua_touserdata(L, 1);
281 switch (*luaL_check_string(L, 2)) {
282 case 'm': lua_mathlibopen(L1); break;
283 case 's': lua_strlibopen(L1); break;
284 case 'i': lua_iolibopen(L1); break;
285 case 'd': lua_dblibopen(L1); break;
286 case 'b': lua_baselibopen(L1); break;
287 default: luaL_argerror(L, 2, "invalid option");
288 }
289 return 0;
290}
291
278static int closestate (lua_State *L) { 292static int closestate (lua_State *L) {
279 luaL_checktype(L, 1, "userdata"); 293 luaL_checktype(L, 1, "userdata");
280 lua_close((lua_State *)lua_touserdata(L, 1)); 294 lua_close((lua_State *)lua_touserdata(L, 1));
@@ -405,7 +419,7 @@ static int testC (lua_State *L) {
405 else if EQ("call") { 419 else if EQ("call") {
406 int narg = getnum; 420 int narg = getnum;
407 int nres = getnum; 421 int nres = getnum;
408 if (lua_call(L, narg, nres)) lua_error(L, NULL); 422 lua_rawcall(L, narg, nres);
409 } 423 }
410 else if EQ("type") { 424 else if EQ("type") {
411 lua_pushstring(L, lua_type(L, getnum)); 425 lua_pushstring(L, lua_type(L, getnum));
@@ -425,6 +439,7 @@ static const struct luaL_reg tests_funcs[] = {
425 {"listcode", listcode}, 439 {"listcode", listcode},
426 {"liststrings", liststrings}, 440 {"liststrings", liststrings},
427 {"listlocals", listlocals}, 441 {"listlocals", listlocals},
442 {"loadlib", loadlib},
428 {"querystr", string_query}, 443 {"querystr", string_query},
429 {"querytab", table_query}, 444 {"querytab", table_query},
430 {"testC", testC}, 445 {"testC", testC},