// %override wxLua_function_isgcobject // %function bool isgcobject(void* object) static int LUACALL wxLua_function_isgcobject(lua_State *L) { bool ret = false; if (wxlua_iswxuserdatatype(wxluaT_type(L, 1))) { void* obj_ptr = wxlua_touserdata(L, 1, false); ret = wxluaO_isgcobject(L, obj_ptr); } lua_pushboolean(L, ret); return 1; }
wxString wxLuaDebugData::GetUserDataInfo(lua_State *L, int stack_idx, bool full_userdata) { wxCHECK_MSG(L, wxEmptyString, wxT("Invalid lua_State")); void* udata = lua_touserdata(L, stack_idx); wxString s(wxString::Format(wxT("%p"), udata)); if (!full_userdata) { // Convert our known keys to something more readable if ((udata == &wxlua_lreg_types_key) || (udata == &wxlua_lreg_refs_key) || (udata == &wxlua_lreg_debug_refs_key) || (udata == &wxlua_lreg_classes_key) || (udata == &wxlua_lreg_derivedmethods_key) || (udata == &wxlua_lreg_wxluastate_key) || (udata == &wxlua_lreg_wxluabindings_key) || (udata == &wxlua_lreg_weakobjects_key) || (udata == &wxlua_lreg_gcobjects_key) || (udata == &wxlua_lreg_evtcallbacks_key) || (udata == &wxlua_lreg_windestroycallbacks_key) || (udata == &wxlua_lreg_callbaseclassfunc_key) || (udata == &wxlua_lreg_wxeventtype_key) || (udata == &wxlua_lreg_wxluastatedata_key) || (udata == &wxlua_lreg_regtable_key) || (udata == &wxlua_metatable_type_key) || (udata == &wxlua_lreg_topwindows_key) || (udata == &wxlua_metatable_wxluabindclass_key)) { const char* ss = *(const char**)udata; s += wxString::Format(wxT(" (%s)"), lua2wx(ss).c_str()); } } else // is full userdata { int wxl_type = wxluaT_type(L, stack_idx); if (wxlua_iswxuserdatatype(wxl_type)) { s += wxString::Format(wxT(" (wxltype %d)"), wxl_type); wxString wxltypeName(wxluaT_typename(L, wxl_type)); if (!wxltypeName.IsEmpty()) s += wxString::Format(wxT(" '%s'"), wxltypeName.c_str()); } } return s; }
// %override wxLua_function_istrackedobject // %function bool istrackedobject(void* object) static int LUACALL wxLua_function_istrackedobject(lua_State *L) { bool ret = false; int wxl_type = wxluaT_type(L, 1); if (wxlua_iswxuserdatatype(wxl_type)) { void* obj_ptr = wxlua_touserdata(L, 1, false); ret = wxluaO_istrackedweakobject(L, obj_ptr, wxl_type, false); } lua_pushboolean(L, ret); return 1; }