diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-07-05 14:57:11 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-07-05 14:57:11 -0300 |
| commit | 193bf7919ea97a2d1a98734e1a215ee6d3fc021b (patch) | |
| tree | ff88b95b15bdb34961d2c12f33ae0a6bab507a1a | |
| parent | 366c85564874d560b3608349f752e9e490f9002d (diff) | |
| download | lua-193bf7919ea97a2d1a98734e1a215ee6d3fc021b.tar.gz lua-193bf7919ea97a2d1a98734e1a215ee6d3fc021b.tar.bz2 lua-193bf7919ea97a2d1a98734e1a215ee6d3fc021b.zip | |
'printstack' (from ltests.c) made public
That function is useful for debugging the API.
| -rw-r--r-- | ltests.c | 4 | ||||
| -rw-r--r-- | ltests.h | 6 |
2 files changed, 7 insertions, 3 deletions
| @@ -822,7 +822,7 @@ static int listlocals (lua_State *L) { | |||
| 822 | 822 | ||
| 823 | 823 | ||
| 824 | 824 | ||
| 825 | static void printstack (lua_State *L) { | 825 | void lua_printstack (lua_State *L) { |
| 826 | int i; | 826 | int i; |
| 827 | int n = lua_gettop(L); | 827 | int n = lua_gettop(L); |
| 828 | printf("stack: >>\n"); | 828 | printf("stack: >>\n"); |
| @@ -1652,7 +1652,7 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { | |||
| 1652 | printf("%s\n", luaL_tolstring(L1, n, NULL)); | 1652 | printf("%s\n", luaL_tolstring(L1, n, NULL)); |
| 1653 | lua_pop(L1, 1); | 1653 | lua_pop(L1, 1); |
| 1654 | } | 1654 | } |
| 1655 | else printstack(L1); | 1655 | else lua_printstack(L1); |
| 1656 | } | 1656 | } |
| 1657 | else if EQ("print") { | 1657 | else if EQ("print") { |
| 1658 | const char *msg = getstring; | 1658 | const char *msg = getstring; |
| @@ -64,7 +64,6 @@ LUA_API Memcontrol l_memcontrol; | |||
| 64 | extern void *l_Trick; | 64 | extern void *l_Trick; |
| 65 | 65 | ||
| 66 | 66 | ||
| 67 | |||
| 68 | /* | 67 | /* |
| 69 | ** Function to traverse and check all memory used by Lua | 68 | ** Function to traverse and check all memory used by Lua |
| 70 | */ | 69 | */ |
| @@ -76,6 +75,11 @@ LUAI_FUNC int lua_checkmemory (lua_State *L); | |||
| 76 | struct GCObject; | 75 | struct GCObject; |
| 77 | LUAI_FUNC void lua_printobj (lua_State *L, struct GCObject *o); | 76 | LUAI_FUNC void lua_printobj (lua_State *L, struct GCObject *o); |
| 78 | 77 | ||
| 78 | /* | ||
| 79 | ** Function to print the stack | ||
| 80 | */ | ||
| 81 | LUAI_FUNC void lua_printstack (lua_State *L); | ||
| 82 | |||
| 79 | 83 | ||
| 80 | /* test for lock/unlock */ | 84 | /* test for lock/unlock */ |
| 81 | 85 | ||
