diff options
-rw-r--r-- | ClientHamr/GuiLua/test_c.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/ClientHamr/GuiLua/test_c.c b/ClientHamr/GuiLua/test_c.c index c090ed9..e4ca278 100644 --- a/ClientHamr/GuiLua/test_c.c +++ b/ClientHamr/GuiLua/test_c.c | |||
@@ -36,7 +36,7 @@ static int cfunc (lua_State *L) | |||
36 | } | 36 | } |
37 | 37 | ||
38 | 38 | ||
39 | /* | 39 | |
40 | static void dumpStack(lua_State *L, int i) | 40 | static void dumpStack(lua_State *L, int i) |
41 | { | 41 | { |
42 | int type = lua_type(L, i); | 42 | int type = lua_type(L, i); |
@@ -56,7 +56,7 @@ static void dumpStack(lua_State *L, int i) | |||
56 | default : printf("Stack %d is unknown\n", i); break; | 56 | default : printf("Stack %d is unknown\n", i); break; |
57 | } | 57 | } |
58 | } | 58 | } |
59 | */ | 59 | |
60 | 60 | ||
61 | /* local test_c = require 'test_c' | 61 | /* local test_c = require 'test_c' |
62 | 62 | ||
@@ -110,12 +110,12 @@ int luaopen_test_c(lua_State *L) | |||
110 | 110 | ||
111 | // At this point the stack should be - 'test_c', skang, _M. Let's test that. | 111 | // At this point the stack should be - 'test_c', skang, _M. Let's test that. |
112 | /* | 112 | /* |
113 | int top = 0, i; | 113 | int top = 0, j; |
114 | 114 | ||
115 | top = lua_gettop(L); | 115 | top = lua_gettop(L); |
116 | printf("MODULE test_c has %d stack items.\n", top); | 116 | printf("MODULE test_c has %d stack items.\n", top); |
117 | for (i = 1; i <= top; i++) | 117 | for (j = 1; j <= top; j++) |
118 | dumpStack(L, i); | 118 | dumpStack(L, j); |
119 | */ | 119 | */ |
120 | 120 | ||
121 | // Save this module in the C registry. | 121 | // Save this module in the C registry. |
@@ -178,7 +178,15 @@ int luaopen_test_c(lua_State *L) | |||
178 | // skang.moduleEnd(_M) | 178 | // skang.moduleEnd(_M) |
179 | lua_getfield(L, skang, "moduleEnd"); | 179 | lua_getfield(L, skang, "moduleEnd"); |
180 | lua_getfield(L, LUA_REGISTRYINDEX, ourName); | 180 | lua_getfield(L, LUA_REGISTRYINDEX, ourName); |
181 | // TODO - This should be (L, 1, 0), but that makes test.lua fail, claiming that none of the Things got added. WTF? | ||
181 | lua_call(L, 1, 1); | 182 | lua_call(L, 1, 1); |
182 | 183 | ||
184 | int top = 0, j; | ||
185 | |||
186 | top = lua_gettop(L); | ||
187 | printf("MODULE test_c has %d stack items.\n", top); | ||
188 | for (j = 1; j <= top; j++) | ||
189 | dumpStack(L, j); | ||
190 | |||
183 | return 1; | 191 | return 1; |
184 | } | 192 | } |