diff options
| author | Lua Team <team@lua.org> | 2010-11-16 12:00:00 +0000 |
|---|---|---|
| committer | repogen <> | 2010-11-16 12:00:00 +0000 |
| commit | ccd28dfe034d5dfd130e5378a147e3e9fe7f6807 (patch) | |
| tree | f1c922e8064f556c1034511afbbb3376640c4d27 /src/ldblib.c | |
| parent | d4bba06f4b8264eee00b25ee08e982d348486aaf (diff) | |
| download | lua-github-5.2.0-alpha-rc1.tar.gz | |
Lua 5.2.0-alpha-rc15.2.0-alpha-rc1
Diffstat (limited to 'src/ldblib.c')
| -rw-r--r-- | src/ldblib.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/ldblib.c b/src/ldblib.c index 9ae6f86b..04213159 100644 --- a/src/ldblib.c +++ b/src/ldblib.c @@ -1,5 +1,5 @@ /* -** $Id: ldblib.c,v 1.124 2010/07/25 15:18:19 roberto Exp $ +** $Id: ldblib.c,v 1.125 2010/11/10 18:06:10 roberto Exp $ ** Interface from Lua to its debug API ** See Copyright Notice in lua.h */ @@ -44,15 +44,22 @@ static int db_setmetatable (lua_State *L) { } +static void checkudata (lua_State *L, int narg) { + if (lua_type(L, narg) == LUA_TLIGHTUSERDATA) + luaL_argerror(L, narg, "full userdata expected, got light userdata"); + luaL_checktype(L, narg, LUA_TUSERDATA); +} + + static int db_getuservalue (lua_State *L) { - luaL_checktype(L, 1, LUA_TUSERDATA); + checkudata(L, 1); lua_getuservalue(L, 1); return 1; } static int db_setuservalue (lua_State *L) { - luaL_checktype(L, 1, LUA_TUSERDATA); + checkudata(L, 1); if (!lua_isnoneornil(L, 2)) luaL_checktype(L, 2, LUA_TTABLE); lua_settop(L, 2); |
