diff options
author | David Walter Seikel | 2014-04-17 15:05:57 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-04-17 15:05:57 +1000 |
commit | 9737c1716c740f15b5336024e3c942230b1d0590 (patch) | |
tree | ddacb9e0b32f97a7bfc9b65b72633537ec2a433d | |
parent | Fix the stack usage of test_c. (diff) | |
download | SledjHamr-9737c1716c740f15b5336024e3c942230b1d0590.zip SledjHamr-9737c1716c740f15b5336024e3c942230b1d0590.tar.gz SledjHamr-9737c1716c740f15b5336024e3c942230b1d0590.tar.bz2 SledjHamr-9737c1716c740f15b5336024e3c942230b1d0590.tar.xz |
Give more info in dumpStack().
-rw-r--r-- | ClientHamr/GuiLua/GuiLua.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/ClientHamr/GuiLua/GuiLua.c b/ClientHamr/GuiLua/GuiLua.c index 252ebb1..3c068c7 100644 --- a/ClientHamr/GuiLua/GuiLua.c +++ b/ClientHamr/GuiLua/GuiLua.c | |||
@@ -155,12 +155,24 @@ void dumpStack(lua_State *L, int i) | |||
155 | { | 155 | { |
156 | case LUA_TNONE : printf("Stack %d is empty\n", i); break; | 156 | case LUA_TNONE : printf("Stack %d is empty\n", i); break; |
157 | case LUA_TNIL : printf("Stack %d is a nil\n", i); break; | 157 | case LUA_TNIL : printf("Stack %d is a nil\n", i); break; |
158 | case LUA_TBOOLEAN : printf("Stack %d is a boolean\n", i); break; | 158 | case LUA_TBOOLEAN : printf("Stack %d is a boolean - %d\n", i, lua_toboolean(L, i)); break; |
159 | case LUA_TNUMBER : printf("Stack %d is a number\n", i); break; | 159 | case LUA_TNUMBER : printf("Stack %d is a number\n - %f", i, lua_tonumber(L, i)); break; |
160 | case LUA_TSTRING : printf("Stack %d is a string - %s\n", i, lua_tostring(L, i)); break; | 160 | case LUA_TSTRING : printf("Stack %d is a string - %s\n", i, lua_tostring(L, i)); break; |
161 | case LUA_TFUNCTION : printf("Stack %d is a function\n", i); break; | 161 | case LUA_TFUNCTION : printf("Stack %d is a function\n", i); break; |
162 | case LUA_TTHREAD : printf("Stack %d is a thread\n", i); break; | 162 | case LUA_TTHREAD : printf("Stack %d is a thread\n", i); break; |
163 | case LUA_TTABLE : printf("Stack %d is a table\n", i); break; | 163 | case LUA_TTABLE : |
164 | { | ||
165 | int j; | ||
166 | |||
167 | printf("Stack %d is a table", i); | ||
168 | lua_getfield(L, i, "_NAME"); | ||
169 | j = lua_gettop(L); | ||
170 | if (lua_isstring(L, j)) | ||
171 | printf(" - %s", lua_tostring(L, j)); | ||
172 | lua_pop(L, 1); | ||
173 | printf("\n"); | ||
174 | break; | ||
175 | } | ||
164 | case LUA_TUSERDATA : printf("Stack %d is a userdata\n", i); break; | 176 | case LUA_TUSERDATA : printf("Stack %d is a userdata\n", i); break; |
165 | case LUA_TLIGHTUSERDATA : printf("Stack %d is a light userdata\n", i); break; | 177 | case LUA_TLIGHTUSERDATA : printf("Stack %d is a light userdata\n", i); break; |
166 | default : printf("Stack %d is unknown\n", i); break; | 178 | default : printf("Stack %d is unknown\n", i); break; |