[patch] luaL_checkudata problem
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: [patch] luaL_checkudata problem
- From: Wolfgang Oertl <wolfgang.oertl@...>
- Date: 2005年9月11日 06:00:34 +0200
Hi,
The following line always fails (5.1-alpha):
luaL_checkudata(L, -1, "something");
The enclosed patch fixes it. If there's a bug tracking facility
somewhere, then I haven't found it yet.
HTH
Wolfgang Oertl
--- lua-5.1-alpha-orig/src/lauxlib.c 2005年09月06日 19:20:11.000000000 +0200
+++ lua-5.1-alpha/src/lauxlib.c 2005年09月11日 05:57:54.000000000 +0200
@@ -123,6 +123,7 @@
LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {
void *p = lua_touserdata(L, ud);
+ ud = abs_index(L, ud);
lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */
if (p == NULL || !lua_getmetatable(L, ud) || !lua_rawequal(L, -1, -2))
luaL_typerror(L, ud, tname);