diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-04-07 11:35:00 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-04-07 11:35:00 -0300 |
| commit | 2ad947fe031aa739d98474eb933eede3659305ac (patch) | |
| tree | 914e41e8ec3e20d5010e27d9cbbe9431c5e6e21c | |
| parent | f0cc013afac750ed8ebc79fa3c2413121543ecc7 (diff) | |
| download | lua-2ad947fe031aa739d98474eb933eede3659305ac.tar.gz lua-2ad947fe031aa739d98474eb933eede3659305ac.tar.bz2 lua-2ad947fe031aa739d98474eb933eede3659305ac.zip | |
new test options for luaL_getn/setn
| -rw-r--r-- | ltests.c | 12 |
1 files changed, 11 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 1.156 2003/03/19 21:14:53 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.157 2003/04/03 13:35:34 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 | */ |
| @@ -717,6 +717,16 @@ static int testC (lua_State *L) { | |||
| 717 | else if EQ("type") { | 717 | else if EQ("type") { |
| 718 | lua_pushstring(L, lua_typename(L, lua_type(L, getnum))); | 718 | lua_pushstring(L, lua_typename(L, lua_type(L, getnum))); |
| 719 | } | 719 | } |
| 720 | else if EQ("getn") { | ||
| 721 | int i = getnum; | ||
| 722 | lua_pushintegral(L, luaL_getn(L, i)); | ||
| 723 | } | ||
| 724 | else if EQ("setn") { | ||
| 725 | int i = getnum; | ||
| 726 | int n = cast(int, lua_tonumber(L, -1)); | ||
| 727 | luaL_setn(L, i, n); | ||
| 728 | lua_pop(L, 1); | ||
| 729 | } | ||
| 720 | else luaL_error(L, "unknown instruction %s", buff); | 730 | else luaL_error(L, "unknown instruction %s", buff); |
| 721 | } | 731 | } |
| 722 | return 0; | 732 | return 0; |
