From 50e29525936be4891f9db090f293432913b5f7c0 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 25 Jan 2002 20:14:54 -0200 Subject: first version of dynamic stack --- ltests.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'ltests.c') diff --git a/ltests.c b/ltests.c index 3e63d0d3..2fe4d694 100644 --- a/ltests.c +++ b/ltests.c @@ -254,10 +254,14 @@ static int hash_query (lua_State *L) { } -static int Cstacklevel (lua_State *L) { +static int stacklevel (lua_State *L) { unsigned long a = 0; + lua_pushnumber(L, (int)(L->top - L->stack)); + lua_pushnumber(L, (int)(L->stack_last - L->stack)); + lua_pushnumber(L, (int)(L->ci - L->base_ci)); + lua_pushnumber(L, (int)(L->end_ci - L->base_ci)); lua_pushnumber(L, (unsigned long)&a); - return 1; + return 5; } @@ -307,7 +311,7 @@ static int string_query (lua_State *L) { int n = 0; for (ts = tb->hash[s]; ts; ts = ts->tsv.nexthash) { setsvalue(L->top, ts); - incr_top; + incr_top(L); n++; } return n; @@ -629,7 +633,7 @@ static const struct luaL_reg tests_funcs[] = { {"listk", listk}, {"listlocals", listlocals}, {"loadlib", loadlib}, - {"Cstacklevel", Cstacklevel}, + {"stacklevel", stacklevel}, {"querystr", string_query}, {"querytab", table_query}, {"testC", testC}, -- cgit v1.2.3-55-g6feb