diff options
| -rw-r--r-- | ltests.c | 14 |
1 files changed, 13 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 1.135 2002/09/05 19:57:08 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.136 2002/10/22 17:18:28 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 | */ |
| @@ -478,6 +478,17 @@ static int log2_aux (lua_State *L) { | |||
| 478 | } | 478 | } |
| 479 | 479 | ||
| 480 | 480 | ||
| 481 | static int test_do (lua_State *L) { | ||
| 482 | const char *p = luaL_check_string(L, 1); | ||
| 483 | if (*p == '@') | ||
| 484 | lua_dofile(L, p+1); | ||
| 485 | else | ||
| 486 | lua_dostring(L, p); | ||
| 487 | return lua_gettop(L); | ||
| 488 | } | ||
| 489 | |||
| 490 | |||
| 491 | |||
| 481 | /* | 492 | /* |
| 482 | ** {====================================================== | 493 | ** {====================================================== |
| 483 | ** function to test the API with C. It interprets a kind of assembler | 494 | ** function to test the API with C. It interprets a kind of assembler |
| @@ -683,6 +694,7 @@ static const struct luaL_reg tests_funcs[] = { | |||
| 683 | {"stacklevel", stacklevel}, | 694 | {"stacklevel", stacklevel}, |
| 684 | {"querystr", string_query}, | 695 | {"querystr", string_query}, |
| 685 | {"querytab", table_query}, | 696 | {"querytab", table_query}, |
| 697 | {"doit", test_do}, | ||
| 686 | {"testC", testC}, | 698 | {"testC", testC}, |
| 687 | {"ref", tref}, | 699 | {"ref", tref}, |
| 688 | {"getref", getref}, | 700 | {"getref", getref}, |
