lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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);