diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-09-07 15:59:59 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-09-07 15:59:59 -0300 |
commit | b1450721be39b9cb7b60144ec5115e379c56de77 (patch) | |
tree | b428cee04782d826b40e0ded740af8ba942ba6a5 | |
parent | b04294d3d87d399e69f5b6329e93f565bd4cf40a (diff) | |
download | lua-b1450721be39b9cb7b60144ec5115e379c56de77.tar.gz lua-b1450721be39b9cb7b60144ec5115e379c56de77.tar.bz2 lua-b1450721be39b9cb7b60144ec5115e379c56de77.zip |
new function "lua_nups" (number of upvalues).
-rw-r--r-- | lapi.c | 8 | ||||
-rw-r--r-- | luadebug.h | 3 |
2 files changed, 9 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.26 1998/07/12 16:16:02 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.27 1998/08/21 17:43:44 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -452,6 +452,12 @@ lua_Function lua_stackedfunction (int level) | |||
452 | } | 452 | } |
453 | 453 | ||
454 | 454 | ||
455 | int lua_nups (lua_Function func) { | ||
456 | TObject *o = luaA_Address(func); | ||
457 | return (!o || normalized_type(o) != LUA_T_CLOSURE) ? 0 : o->value.cl->nelems; | ||
458 | } | ||
459 | |||
460 | |||
455 | int lua_currentline (lua_Function func) | 461 | int lua_currentline (lua_Function func) |
456 | { | 462 | { |
457 | TObject *f = Address(func); | 463 | TObject *f = Address(func); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luadebug.h,v 1.1 1997/09/16 19:25:59 roberto Exp roberto $ | 2 | ** $Id: luadebug.h,v 1.2 1998/06/19 16:14:09 roberto Exp roberto $ |
3 | ** Debugging API | 3 | ** Debugging API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -24,6 +24,7 @@ char *lua_getobjname (lua_Object o, char **name); | |||
24 | lua_Object lua_getlocal (lua_Function func, int local_number, char **name); | 24 | lua_Object lua_getlocal (lua_Function func, int local_number, char **name); |
25 | int lua_setlocal (lua_Function func, int local_number); | 25 | int lua_setlocal (lua_Function func, int local_number); |
26 | 26 | ||
27 | int lua_nups (lua_Function func); | ||
27 | 28 | ||
28 | extern lua_LHFunction lua_linehook; | 29 | extern lua_LHFunction lua_linehook; |
29 | extern lua_CHFunction lua_callhook; | 30 | extern lua_CHFunction lua_callhook; |