From: John L. <jr...@us...> - 2008-01-05 00:15:50
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10306/wxLua/modules/wxlua/src Modified Files: wxlstate.cpp wxlua_bind.cpp Log Message: A little more cleanup. Fix for Lua clearing weak refs even before the __gc call is made so we miscounted how many instances of the userdata we had and deleted it thinking it was the last. Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** wxlstate.cpp 4 Jan 2008 00:21:08 -0000 1.158 --- wxlstate.cpp 5 Jan 2008 00:15:46 -0000 1.159 *************** *** 27,32 **** const char* wxlua_lreg_types_key = "wxLua metatable class types"; ! const char* wxlua_lreg_refs_key = "wxLua object references"; ! const char* wxlua_lreg_debug_refs_key = "wxLuaDebugData references"; const char* wxlua_lreg_classes_key = "wxLuaBindClass structs"; const char* wxlua_lreg_derivedmethods_key = "wxLua derived class methods"; --- 27,32 ---- const char* wxlua_lreg_types_key = "wxLua metatable class types"; ! const char* wxlua_lreg_refs_key = "wxLua Lua object refs"; ! const char* wxlua_lreg_debug_refs_key = "wxLuaDebugData refs"; const char* wxlua_lreg_classes_key = "wxLuaBindClass structs"; const char* wxlua_lreg_derivedmethods_key = "wxLua derived class methods"; *************** *** 42,47 **** const char* wxlua_lreg_regtable_key = "wxLua LUA_REGISTRYINDEX tables"; ! const char* wxlua_metatable_type_key = "wxLua Metatable class type"; ! const char* wxlua_metatable_wxluabindclass_key = "wxLua Metatable wxLuaBindClass"; wxLuaState wxNullLuaState(false); --- 42,47 ---- const char* wxlua_lreg_regtable_key = "wxLua LUA_REGISTRYINDEX tables"; ! const char* wxlua_metatable_type_key = "wxLua metatable class type"; ! const char* wxlua_metatable_wxluabindclass_key = "wxLua metatable wxLuaBindClass"; wxLuaState wxNullLuaState(false); *************** *** 186,195 **** lua_pushnil(L); // push value lua_rawset(L, -3); // clear t[key] = nil ! lua_pop(L, 1); } else lua_pop(L, 2); // pop nil and wxlua_lreg_regtable_key table ! // Add new LUA_REGISTRYINDEX[lightuserdata_reg_key table] = lightuserdata_reg_key lua_pushlightuserdata(L, lightuserdata_reg_key); // push key lua_createtable(L, narr, nrec); // push value --- 186,195 ---- lua_pushnil(L); // push value lua_rawset(L, -3); // clear t[key] = nil ! lua_pop(L, 1); // pop wxlua_lreg_regtable_key table } else lua_pop(L, 2); // pop nil and wxlua_lreg_regtable_key table ! // Add new LUA_REGISTRYINDEX[&wxlua_lreg_regtable_key][lightuserdata_reg_key table] = lightuserdata_reg_key lua_pushlightuserdata(L, lightuserdata_reg_key); // push key lua_createtable(L, narr, nrec); // push value *************** *** 280,284 **** // call ref 3 times and the new references will be 4, 3, 6 ! int wxluaR_ref(lua_State* L, int stack_idx, const void* lightuserdata_reg_key) { // nothing on stack to insert and don't bother inserting nil --- 280,284 ---- // call ref 3 times and the new references will be 4, 3, 6 ! int wxluaR_ref(lua_State* L, int stack_idx, void* lightuserdata_reg_key) { // nothing on stack to insert and don't bother inserting nil *************** *** 286,316 **** return LUA_REFNIL; ! lua_pushlightuserdata(L, (void*)lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) ! lua_pushvalue(L, ABS_LUA_STKIDX(stack_idx,1)); // push value to store ! int ref_idx = luaL_ref(L, -2); // t[ref_idx] = value; pops value // We also store t[value] = table_idx for this table for faster lookup if (lightuserdata_reg_key == &wxlua_lreg_debug_refs_key) { ! lua_pushvalue(L, ABS_LUA_STKIDX(stack_idx,1)); // push key ! lua_pushnumber(L, ref_idx); // push value ! lua_rawset(L, -3); // set t[key] = value; pops key and value } ! lua_pop(L, 1); // pop table return ref_idx; } ! bool wxluaR_unref(lua_State* L, int ref_idx, const void* lightuserdata_reg_key) { ! if (ref_idx == LUA_REFNIL) // nothing to remove return false; ! lua_pushlightuserdata(L, (void*)lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) // Also remove the t[value] = table_idx for this table --- 286,316 ---- return LUA_REFNIL; ! lua_pushlightuserdata(L, lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) ! lua_pushvalue(L, ABS_LUA_STKIDX(stack_idx,1)); // push value to store ! int ref_idx = luaL_ref(L, -2); // t[ref_idx] = value; pops value // We also store t[value] = table_idx for this table for faster lookup if (lightuserdata_reg_key == &wxlua_lreg_debug_refs_key) { ! lua_pushvalue(L, ABS_LUA_STKIDX(stack_idx,1)); // push key ! lua_pushnumber(L, ref_idx); // push value ! lua_rawset(L, -3); // set t[key] = value; pops key and value } ! lua_pop(L, 1); // pop table return ref_idx; } ! bool wxluaR_unref(lua_State* L, int ref_idx, void* lightuserdata_reg_key) { ! if (ref_idx == LUA_REFNIL) // nothing to remove return false; ! lua_pushlightuserdata(L, lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) // Also remove the t[value] = table_idx for this table *************** *** 325,329 **** luaL_unref(L, -1, ref_idx); // remove key and value in refs table ! // note: this key will be used for the next wxluaR_ref lua_pop(L, 1); // pop table --- 325,329 ---- luaL_unref(L, -1, ref_idx); // remove key and value in refs table ! // note: this key will be used for the next wxluaR_ref() lua_pop(L, 1); // pop table *************** *** 332,371 **** } ! bool LUACALL wxluaR_getref(lua_State *L, int ref_idx, const void* lightuserdata_reg_key) { ! if (ref_idx == LUA_REFNIL) // nothing to get return false; ! lua_pushlightuserdata(L, (void*)lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) ! lua_rawgeti(L, -1, ref_idx); // get t[ref_idx] = value; push value ! if (lua_isnil(L, -1)) // not a valid table key { ! lua_pop(L, 2); // pop nil and table return false; } ! lua_remove(L, -2); // remove table, leaving value on top return true; // return if table has a valid value and it's on the stack } ! int LUACALL wxluaR_isrefed(lua_State* L, int stack_idx, const void* lightuserdata_reg_key) { int ref_idx = LUA_NOREF; ! lua_pushlightuserdata(L, (void*)lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) if (lightuserdata_reg_key == &wxlua_lreg_debug_refs_key) { ! // For this table we've push the value for a faster index ! lua_pushvalue(L, ABS_LUA_STKIDX(stack_idx,1)); // push key (the value) ! lua_rawget(L, -2); // get t[key] = value; pop key push value ref_idx = (int)lua_tonumber(L, -1); ! if ((ref_idx == 0) && !lua_isnumber(L, -1)) // if !isnumber it returns 0 (faster) ref_idx = LUA_NOREF; --- 332,371 ---- } ! bool LUACALL wxluaR_getref(lua_State *L, int ref_idx, void* lightuserdata_reg_key) { ! if (ref_idx == LUA_REFNIL) // nothing to get return false; ! lua_pushlightuserdata(L, lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) ! lua_rawgeti(L, -1, ref_idx); // get t[ref_idx] = value; push value ! if (lua_isnil(L, -1)) // not a valid table key { ! lua_pop(L, 2); // pop nil and table return false; } ! lua_remove(L, -2); // remove table, leaving value on top return true; // return if table has a valid value and it's on the stack } ! int LUACALL wxluaR_isrefed(lua_State* L, int stack_idx, void* lightuserdata_reg_key) { int ref_idx = LUA_NOREF; ! lua_pushlightuserdata(L, lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) if (lightuserdata_reg_key == &wxlua_lreg_debug_refs_key) { ! // For this table we've pushed the value for a faster lookup ! lua_pushvalue(L, ABS_LUA_STKIDX(stack_idx,1)); // push key (the value) ! lua_rawget(L, -2); // get t[key] = value; pop key push value ref_idx = (int)lua_tonumber(L, -1); ! if ((ref_idx == 0) && !lua_isnumber(L, -1)) // if !isnumber it returns 0 (faster) ref_idx = LUA_NOREF; *************** *** 403,407 **** wxluaO_addgcobject(L, (void*)wxobj, wxobj); } ! void LUACALL wxluaO_addgcobject(lua_State *L, const void *obj_ptr, wxObject* wxobj) { lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key --- 403,407 ---- wxluaO_addgcobject(L, (void*)wxobj, wxobj); } ! void LUACALL wxluaO_addgcobject(lua_State *L, void *obj_ptr, wxObject* wxobj) { lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key *************** *** 409,414 **** // Check if it's already tracked since that means the weak udata table isn't working right ! lua_pushlightuserdata(L, (void*)obj_ptr); // push key ! lua_rawget(L, -2); // get t[key] = value, pops key if (!lua_isnil(L, -1)) { --- 409,414 ---- // Check if it's already tracked since that means the weak udata table isn't working right ! lua_pushlightuserdata(L, obj_ptr); // push key ! lua_rawget(L, -2); // get t[key] = value, pops key if (!lua_isnil(L, -1)) { *************** *** 420,426 **** // Then add it ! lua_pushlightuserdata(L, (void*)obj_ptr); // push key ! lua_pushlightuserdata(L, wxobj); // push value ! lua_rawset(L, -3); // set t[key] = value, pops key and value lua_pop(L, 1); // pop table --- 420,426 ---- // Then add it ! lua_pushlightuserdata(L, obj_ptr); // push key ! lua_pushlightuserdata(L, wxobj); // push value ! lua_rawset(L, -3); // set t[key] = value, pops key and value lua_pop(L, 1); // pop table *************** *** 429,433 **** bool LUACALL wxluaO_deletegcobject(lua_State *L, void* udata, void *obj_ptr, int flags) { ! if (obj_ptr == 0) return false; // can happen bool delete_all = WXLUA_HASBIT(flags, WXLUA_DELETE_OBJECT_ALL); --- 429,433 ---- bool LUACALL wxluaO_deletegcobject(lua_State *L, void* udata, void *obj_ptr, int flags) { ! if (obj_ptr == NULL) return false; // can happen bool delete_all = WXLUA_HASBIT(flags, WXLUA_DELETE_OBJECT_ALL); *************** *** 436,440 **** int udata_count = wxluaO_untrackweakobject(L, delete_all ? NULL : udata, obj_ptr); ! if (delete_all || (udata_count < 2)) { wxlua_removederivedmethods(L, obj_ptr); --- 436,440 ---- int udata_count = wxluaO_untrackweakobject(L, delete_all ? NULL : udata, obj_ptr); ! if (delete_all || (udata_count < 1)) { wxlua_removederivedmethods(L, obj_ptr); *************** *** 476,480 **** bool LUACALL wxluaO_undeletegcobject(lua_State *L, void *obj_ptr) { ! if (obj_ptr == 0) return false; lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key --- 476,480 ---- bool LUACALL wxluaO_undeletegcobject(lua_State *L, void *obj_ptr) { ! if (obj_ptr == NULL) return false; lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key *************** *** 558,564 **** lua_newtable(L); lua_newtable(L); // metatable ! lua_pushlstring(L, "__mode", 6); ! lua_pushlstring(L, "v", 1); ! lua_rawset(L, -3); // set mode of main table lua_setmetatable(L, -2); // via the metatable lua_rawset(L, -3); --- 558,564 ---- lua_newtable(L); lua_newtable(L); // metatable ! lua_pushlstring(L, "__mode", 6); ! lua_pushlstring(L, "v", 1); ! lua_rawset(L, -3); // set mode of main table lua_setmetatable(L, -2); // via the metatable lua_rawset(L, -3); *************** *** 592,596 **** int count = 0; - bool cleared_udata = false; if (lua_istable(L, -1)) --- 592,595 ---- *************** *** 602,606 **** // value = -1, key = -2, table = -3 void *u = lua_touserdata(L, -1); - ++count; if ((udata == NULL) || (udata == u)) --- 601,604 ---- *************** *** 612,616 **** if (udata == u) { - cleared_udata = true; lua_pop(L, 1); // pop value --- 610,613 ---- *************** *** 620,630 **** } else lua_pop(L, 1); // pop value, leave key for next iteration } lua_pop(L, 1); // pop obj_ptr table ! if ((udata == NULL) || (count == 0) || ((count == 1) && cleared_udata)) { lua_pushlightuserdata(L, (void*)obj_ptr); // push key lua_pushnil(L); // push value --- 617,632 ---- } else + { + ++count; // only count ones that still exist lua_pop(L, 1); // pop value, leave key for next iteration + } } lua_pop(L, 1); // pop obj_ptr table ! // If we've cleared everything then remove the table ! if ((udata == NULL) || (count == 0)) { + count = 0; // removed them all lua_pushlightuserdata(L, (void*)obj_ptr); // push key lua_pushnil(L); // push value *************** *** 672,675 **** --- 674,714 ---- } + wxArrayString LUACALL wxluaO_gettrackedweakobjectinfo(lua_State *L) + { + wxArrayString arrStr; + + lua_pushlightuserdata(L, &wxlua_lreg_weakobjects_key); // push key + lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) + + lua_pushnil(L); + while (lua_next(L, -2) != 0) + { + // value = -1, key = -2, table = -3 + void* obj_ptr = lua_touserdata(L, -2); // actually lightuserdata + + wxString name; + + // iterate the table of userdata + lua_pushnil(L); + while (lua_next(L, -2) != 0) + { + // value = -1, key = -2, table = -3 + int wxl_type = (int)lua_tonumber(L, -2); + if (!name.IsEmpty()) name += wxT(", "); + name += wxString::Format(wxT("%s(%p, type=%d)"), wxluaT_typename(L, wxl_type).c_str(), lua_touserdata(L, -1), wxl_type); + lua_pop(L, 1); // pop value, lua_next will pop key at end + } + + arrStr.Add(wxString::Format(wxT("%p = %s"), obj_ptr, name.c_str())); + + lua_pop(L, 1); // pop value, lua_next will pop key at end + } + + lua_pop(L, 1); // pop table + + arrStr.Sort(); + return arrStr; + } + // ---------------------------------------------------------------------------- // wxluaW_XXX - functions operate on tracked wxWindows *************** *** 1496,1500 **** for (idx = 0; idx < count; ++idx) { ! lua_pushstring(L, wx2lua(strArray[idx])); lua_rawseti(L, -2, idx + 1); } --- 1535,1539 ---- for (idx = 0; idx < count; ++idx) { ! wxlua_pushwxString(L, strArray[idx]); lua_rawseti(L, -2, idx + 1); } *************** *** 1520,1523 **** --- 1559,1575 ---- } + wxString wxlua_concatwxArrayString(const wxArrayString& arr, const wxString& sep) + { + wxString s; + size_t n, count = arr.GetCount(); + for (n = 0; n < count; ++n) + { + s += arr[n]; + if (n < count - 1) s += sep; + } + + return s; + } + //---------------------------------------------------------------------------- // Derived class member functions for classes in wxLua *************** *** 2768,2772 **** } ! void wxLuaState::AddGCObject(const void* obj_ptr, wxObject *wxobj) { wxCHECK_RET(Ok() && wxobj, wxT("Invalid wxLuaState or wxObject to track")); --- 2820,2824 ---- } ! void wxLuaState::AddGCObject(void* obj_ptr, wxObject *wxobj) { wxCHECK_RET(Ok() && wxobj, wxT("Invalid wxLuaState or wxObject to track")); *************** *** 2956,2960 **** // wxLua Lua Registry Table Functions ! int wxLuaState::wxluaR_Ref(int stack_idx, const void* lightuserdata_reg_key) { wxCHECK_MSG(Ok(), LUA_REFNIL, wxT("Invalid wxLuaState")); --- 3008,3012 ---- // wxLua Lua Registry Table Functions ! int wxLuaState::wxluaR_Ref(int stack_idx, void* lightuserdata_reg_key) { wxCHECK_MSG(Ok(), LUA_REFNIL, wxT("Invalid wxLuaState")); *************** *** 2962,2966 **** } ! bool wxLuaState::wxluaR_Unref(int wxlref_index, const void* lightuserdata_reg_key) { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); --- 3014,3018 ---- } ! bool wxLuaState::wxluaR_Unref(int wxlref_index, void* lightuserdata_reg_key) { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); *************** *** 2968,2972 **** } ! bool wxLuaState::wxluaR_GetRef(int wxlref_index, const void* lightuserdata_reg_key) { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); --- 3020,3024 ---- } ! bool wxLuaState::wxluaR_GetRef(int wxlref_index, void* lightuserdata_reg_key) { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); Index: wxlua_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlua_bind.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** wxlua_bind.cpp 22 Dec 2007 06:07:16 -0000 1.19 --- wxlua_bind.cpp 5 Jan 2008 00:15:46 -0000 1.20 *************** *** 724,768 **** static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetBindings[1] = {{ wxLua_function_GetBindings, WXLUAMETHOD_CFUNCTION, 0, 0, g_wxluaargtypeArray_None }}; // %override wxLua_function_GetGCUserdataInfo ! // %function LuaTable GetTrackedUserData() static int LUACALL wxLua_function_GetGCUserdataInfo(lua_State *L) { ! wxlua_pushwxArrayStringtable(L, wxluaO_getgcobjectinfo(L)); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetGCUserdataInfo[1] = {{ wxLua_function_GetGCUserdataInfo, WXLUAMETHOD_CFUNCTION, 0, 0, g_wxluaargtypeArray_None }}; // %override wxLua_function_GetTrackedEventCallbackInfo ! // %function LuaTable GetTrackedEventCallbackInfo() static int LUACALL wxLua_function_GetTrackedEventCallbackInfo(lua_State *L) { wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedEventCallbackInfo()); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedEventCallbackInfo[1] = {{ wxLua_function_GetTrackedEventCallbackInfo, WXLUAMETHOD_CFUNCTION, 0, 0, g_wxluaargtypeArray_None }}; // %override wxLua_function_GetTrackedWinDestroyCallbackInfo ! // %function LuaTable GetTrackedWinDestroyCallbackInfo() static int LUACALL wxLua_function_GetTrackedWinDestroyCallbackInfo(lua_State *L) { wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedWinDestroyCallbackInfo()); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedWinDestroyCallbackInfo[1] = {{ wxLua_function_GetTrackedWinDestroyCallbackInfo, WXLUAMETHOD_CFUNCTION, 0, 0, g_wxluaargtypeArray_None }}; // %override wxLua_function_GetTrackedWindowInfo ! // %function LuaTable GetTrackedTopLevelWindows() static int LUACALL wxLua_function_GetTrackedWindowInfo(lua_State *L) { ! wxlua_pushwxArrayStringtable(L, wxluaW_gettrackedwindowinfo(L)); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedWindowInfo[1] = {{ wxLua_function_GetTrackedWindowInfo, WXLUAMETHOD_CFUNCTION, 0, 0, g_wxluaargtypeArray_None }}; static wxLuaArgType s_wxluatypeArray_wxLua_function_iswxluatype[] = { &g_wxluatype_TNUMBER, &g_wxluatype_TNUMBER, NULL }; --- 724,808 ---- static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetBindings[1] = {{ wxLua_function_GetBindings, WXLUAMETHOD_CFUNCTION, 0, 0, g_wxluaargtypeArray_None }}; + static wxLuaArgType s_wxluatypeArray_wxLua_function_GetGCUserdataInfo[] = { &g_wxluatype_TBOOLEAN, NULL }; // %override wxLua_function_GetGCUserdataInfo ! // %function LuaTable GetGCUserdataInfo(bool as_string = false) static int LUACALL wxLua_function_GetGCUserdataInfo(lua_State *L) { ! bool as_string = lua_toboolean(L, 1); // ok if nil ! if (as_string) ! wxlua_pushwxString(L, wxlua_concatwxArrayString(wxluaO_getgcobjectinfo(L))); ! else ! wxlua_pushwxArrayStringtable(L, wxluaO_getgcobjectinfo(L)); ! return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetGCUserdataInfo[1] = {{ wxLua_function_GetGCUserdataInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetGCUserdataInfo }}; + static wxLuaArgType s_wxluatypeArray_wxLua_function_GetTrackedEventCallbackInfo[] = { &g_wxluatype_TBOOLEAN, NULL }; // %override wxLua_function_GetTrackedEventCallbackInfo ! // %function LuaTable GetTrackedEventCallbackInfo(bool as_string = false) static int LUACALL wxLua_function_GetTrackedEventCallbackInfo(lua_State *L) { wxLuaState wxlState(L); ! bool as_string = lua_toboolean(L, 1); // ok if nil ! if (as_string) ! wxlua_pushwxString(L, wxlua_concatwxArrayString(wxlState.GetTrackedEventCallbackInfo())); ! else ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedEventCallbackInfo()); ! return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedEventCallbackInfo[1] = {{ wxLua_function_GetTrackedEventCallbackInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetTrackedEventCallbackInfo }}; + static wxLuaArgType s_wxluatypeArray_wxLua_function_GetTrackedObjectInfo[] = { &g_wxluatype_TBOOLEAN, NULL }; + // %override wxLua_function_GetTrackedObjectInfo + // %function LuaTable GetTrackedObjectInfo(bool as_string = false) + static int LUACALL wxLua_function_GetTrackedObjectInfo(lua_State *L) + { + bool as_string = lua_toboolean(L, 1); // ok if nil + if (as_string) + wxlua_pushwxString(L, wxlua_concatwxArrayString(wxluaO_gettrackedweakobjectinfo(L))); + else + wxlua_pushwxArrayStringtable(L, wxluaO_gettrackedweakobjectinfo(L)); + + return 1; + } + + static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedObjectInfo[1] = {{ wxLua_function_GetTrackedObjectInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetTrackedObjectInfo }}; + + static wxLuaArgType s_wxluatypeArray_wxLua_function_GetTrackedWinDestroyCallbackInfo[] = { &g_wxluatype_TBOOLEAN, NULL }; // %override wxLua_function_GetTrackedWinDestroyCallbackInfo ! // %function LuaTable GetTrackedWinDestroyCallbackInfo(bool as_string = false) static int LUACALL wxLua_function_GetTrackedWinDestroyCallbackInfo(lua_State *L) { wxLuaState wxlState(L); ! bool as_string = lua_toboolean(L, 1); // ok if nil ! if (as_string) ! wxlua_pushwxString(L, wxlua_concatwxArrayString(wxlState.GetTrackedWinDestroyCallbackInfo())); ! else ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedWinDestroyCallbackInfo()); ! return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedWinDestroyCallbackInfo[1] = {{ wxLua_function_GetTrackedWinDestroyCallbackInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetTrackedWinDestroyCallbackInfo }}; + static wxLuaArgType s_wxluatypeArray_wxLua_function_GetTrackedWindowInfo[] = { &g_wxluatype_TBOOLEAN, NULL }; // %override wxLua_function_GetTrackedWindowInfo ! // %function LuaTable GetTrackedWindowInfo(bool as_string = false) static int LUACALL wxLua_function_GetTrackedWindowInfo(lua_State *L) { ! bool as_string = lua_toboolean(L, 1); // ok if nil ! if (as_string) ! wxlua_pushwxString(L, wxlua_concatwxArrayString(wxluaW_gettrackedwindowinfo(L))); ! else ! wxlua_pushwxArrayStringtable(L, wxluaW_gettrackedwindowinfo(L)); ! return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedWindowInfo[1] = {{ wxLua_function_GetTrackedWindowInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetTrackedWindowInfo }}; static wxLuaArgType s_wxluatypeArray_wxLua_function_iswxluatype[] = { &g_wxluatype_TNUMBER, &g_wxluatype_TNUMBER, NULL }; *************** *** 875,878 **** --- 915,919 ---- { "GetGCUserdataInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetGCUserdataInfo, 1, NULL }, { "GetTrackedEventCallbackInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedEventCallbackInfo, 1, NULL }, + { "GetTrackedObjectInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedObjectInfo, 1, NULL }, { "GetTrackedWinDestroyCallbackInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedWinDestroyCallbackInfo, 1, NULL }, { "GetTrackedWindowInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedWindowInfo, 1, NULL }, |