diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-10-26 10:47:05 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-10-26 10:47:05 -0200 |
| commit | b892f0a8774f573d7ec9b02617428871b8d3a2b3 (patch) | |
| tree | 4aab88443264d84d314ca663cf3c30b48c7e9107 /ltests.c | |
| parent | aadc35449ec2752c298a7a8fa6359a3a12c538ee (diff) | |
| download | lua-b892f0a8774f573d7ec9b02617428871b8d3a2b3.tar.gz lua-b892f0a8774f573d7ec9b02617428871b8d3a2b3.tar.bz2 lua-b892f0a8774f573d7ec9b02617428871b8d3a2b3.zip | |
new API function `createuserdata'
Diffstat (limited to 'ltests.c')
| -rw-r--r-- | ltests.c | 7 |
1 files changed, 5 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 1.50 2000/10/06 19:29:26 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.51 2000/10/20 16:39:03 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -260,7 +260,10 @@ static int unref (lua_State *L) { | |||
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | static int newuserdata (lua_State *L) { | 262 | static int newuserdata (lua_State *L) { |
| 263 | lua_pushusertag(L, (void *)luaL_check_int(L, 1), luaL_check_int(L, 2)); | 263 | if (lua_isnumber(L, 2)) |
| 264 | lua_pushusertag(L, (void *)luaL_check_int(L, 1), luaL_check_int(L, 2)); | ||
| 265 | else | ||
| 266 | lua_newuserdata(L, luaL_check_int(L, 1)); | ||
| 264 | return 1; | 267 | return 1; |
| 265 | } | 268 | } |
| 266 | 269 | ||
