diff options
Diffstat (limited to 'deep_test')
-rw-r--r-- | deep_test/deep_test.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/deep_test/deep_test.c b/deep_test/deep_test.c index 9585a3c..61c81c5 100644 --- a/deep_test/deep_test.c +++ b/deep_test/deep_test.c | |||
@@ -166,8 +166,12 @@ static int clonable_lanesclone( lua_State* L) | |||
166 | { | 166 | { |
167 | switch( lua_gettop( L)) | 167 | switch( lua_gettop( L)) |
168 | { | 168 | { |
169 | case 0: | 169 | case 1: |
170 | lua_pushinteger( L, sizeof( struct s_MyClonableUserdata)); | 170 | { |
171 | // in case we need it to compute the amount of memory we need | ||
172 | struct s_MyClonableUserdata* self = lua_touserdata( L, 1); | ||
173 | lua_pushinteger( L, sizeof( struct s_MyClonableUserdata)); | ||
174 | } | ||
171 | return 1; | 175 | return 1; |
172 | 176 | ||
173 | case 2: | 177 | case 2: |
@@ -175,8 +179,8 @@ static int clonable_lanesclone( lua_State* L) | |||
175 | struct s_MyClonableUserdata* self = lua_touserdata( L, 1); | 179 | struct s_MyClonableUserdata* self = lua_touserdata( L, 1); |
176 | struct s_MyClonableUserdata* from = lua_touserdata( L, 2); | 180 | struct s_MyClonableUserdata* from = lua_touserdata( L, 2); |
177 | *self = *from; | 181 | *self = *from; |
178 | return 0; | ||
179 | } | 182 | } |
183 | return 0; | ||
180 | 184 | ||
181 | default: | 185 | default: |
182 | (void) luaL_error( L, "Lanes called clonable_lanesclone with unexpected parameters"); | 186 | (void) luaL_error( L, "Lanes called clonable_lanesclone with unexpected parameters"); |
@@ -223,7 +227,7 @@ extern int __declspec(dllexport) luaopen_deep_test(lua_State* L) | |||
223 | { | 227 | { |
224 | luaL_newlib( L, deep_module); // M | 228 | luaL_newlib( L, deep_module); // M |
225 | 229 | ||
226 | // preregister the metatables for the types we can instanciate so that Lanes can know about them | 230 | // preregister the metatables for the types we can instantiate so that Lanes can know about them |
227 | if( luaL_newmetatable( L, "clonable")) // M mt | 231 | if( luaL_newmetatable( L, "clonable")) // M mt |
228 | { | 232 | { |
229 | luaL_setfuncs( L, clonable_mt, 0); | 233 | luaL_setfuncs( L, clonable_mt, 0); |