Original Post
I have a function where I register C++ classes as user data in lua, and I wanted to avoid registering the same thing more than once, so I added two lines to the beginning of my register code: So, if it succeeds and finds the userdata, return immediately. Else, go ahead with registration. However, when checkudata fails, it goes through: luaL_typerror luaL_argerror luaL_error lua_error luaG_errormsg luaD_throw and finally, since L->errorJmp == NULL, exit I've googled around and read docs for the past hour or so, but I haven't yet stumbled across an appropriate way of dealing with this situation so that it does something (anything) other than exit()'ing. Help? :)
if (luaL_checkudata(L, lua_gettop(L), T::className))
return;