From: John L. <jr...@us...> - 2007-12-07 02:13:20
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv12976/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlcallb.cpp wxlstate.cpp wxlua.cpp wxlua_bind.cpp Log Message: Too many changes to list... A large portion of the internal workings of the wxLuaState have been rewritten. All of the data that was stored in wxLuaStateData that might be needed by a function taking a lua_State* is now in the LUA_REGISTRYINDEX. C functions have been added to access these values. The generated bindings no longer need to have "wxLuaState wxlState(L);" since everything can be done with the C functions. The result is that wxLua should be faster. Index: wxlua.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlua.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxlua.cpp 1 Aug 2007 19:15:38 -0000 1.4 --- wxlua.cpp 7 Dec 2007 02:13:14 -0000 1.5 *************** *** 38,45 **** static int LUACALL wxLua_wxLuaState_delete(lua_State *L) { ! wxLuaState wxlState(L); ! wxLuaState * self = (wxLuaState *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaState); // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxlState.RemoveTrackedObject(self, wxLuaState::DELETE_CLEAR_OBJECT)) { lua_pushnil(L); --- 38,44 ---- static int LUACALL wxLua_wxLuaState_delete(lua_State *L) { ! wxLuaState * self = (wxLuaState *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLuaState); // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) { lua_pushnil(L); *************** *** 73,80 **** static int LUACALL wxLua_wxLuaObject_GetAllocationFlag(lua_State *L) { - wxLuaState wxlState(L); int returns; // get this ! wxLuaObject * self = (wxLuaObject *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaObject); // call GetAllocationFlag returns = (self->GetAllocationFlag()); --- 72,78 ---- static int LUACALL wxLua_wxLuaObject_GetAllocationFlag(lua_State *L) { int returns; // get this ! wxLuaObject * self = (wxLuaObject *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLuaObject); // call GetAllocationFlag returns = (self->GetAllocationFlag()); *************** *** 125,132 **** static int LUACALL wxLua_wxLuaObject_delete(lua_State *L) { ! wxLuaState wxlState(L); ! wxLuaObject * self = (wxLuaObject *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaObject); // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxlState.RemoveTrackedObject(self, wxLuaState::DELETE_CLEAR_OBJECT)) { lua_pushnil(L); --- 123,129 ---- static int LUACALL wxLua_wxLuaObject_delete(lua_State *L) { ! wxLuaObject * self = (wxLuaObject *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLuaObject); // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) { lua_pushnil(L); Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -d -r1.144 -r1.145 *** wxlstate.cpp 5 Dec 2007 05:54:11 -0000 1.144 --- wxlstate.cpp 7 Dec 2007 02:13:14 -0000 1.145 *************** *** 29,36 **** const char* wxlua_lreg_derivedmethods_key = "wxLua derived class methods"; const char* wxlua_lreg_wxluastate_key = "wxLuaState"; ! const char* wxlua_lreg_objects_key = "wxLua pushed userdata"; const char* wxlua_lreg_evtcallbacks_key = "wxLuaCallbacks"; const char* wxlua_lreg_windestroycallbacks_key = "wxLuaWinDestoyCallbacks"; const char* wxlua_lreg_callbaseclassfunc_key = "wxLua CallBaseClassFunc"; const char* wxlua_metatable_tag_key = "wxLua Metatable Class Tag"; --- 29,40 ---- const char* wxlua_lreg_derivedmethods_key = "wxLua derived class methods"; [...3071 lines suppressed...] --- 3788,3799 ---- wxArrayString wxLuaState::CreateMethodArgTagsMsg(struct wxLuaBindMethod* wxlMethod) { ! wxCHECK_MSG(Ok() && wxlMethod, wxArrayString(), wxT("Invalid wxLuaState or overloaded method table")); ! return wxlua_CreateMethodArgTagsMsg(M_WXLSTATEDATA->m_lua_State, wxlMethod); } int LUACALL wxLuaState::CallOverloadedFunction(struct wxLuaBindMethod* wxlMethod) { ! wxCHECK_MSG(Ok() && wxlMethod, 0, wxT("Invalid wxLuaState or overloaded method table")); ! return wxlua_CallOverloadedFunction(M_WXLSTATEDATA->m_lua_State, wxlMethod); } *************** *** 3855,3857 **** return 1; } - --- 3895,3896 ---- Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** wxlbind.cpp 5 Dec 2007 05:54:11 -0000 1.99 --- wxlbind.cpp 7 Dec 2007 02:13:14 -0000 1.100 *************** *** 89,92 **** --- 89,339 ---- } + // ---------------------------------------------------------------------------- + // Central function to call for overloaded functions + // ---------------------------------------------------------------------------- + + int LUACALL wxlua_CallOverloadedFunction(lua_State* L, struct wxLuaBindMethod* wxlMethod) + { + int i, arg; + int invalidArg = 0; + + // get number of arguments called from Lua + int argCount = lua_gettop(L); + int lua_argStart = 0; + + // don't remove the table, but do skip past it when counting args + bool remove_table = wxluabind_removetableforcall(L, true); + + if (remove_table) + { + argCount--; + lua_argStart++; + } + + // only look at the methods that could possibly work and traverse base classes + wxArrayPtrVoid funcArray; + wxLuaBindMethod* method = wxlMethod; + while (method) + { + for (i = 0; i < method->funcs_n; ++i) + { + if (!WXLUA_HASBIT(method->funcs[i].type, WXLUAMETHOD_OVERLOAD) && + (argCount >= method->funcs[i].minargs) && + (argCount <= method->funcs[i].maxargs)) + { + funcArray.Add(&method->funcs[i]); + } + + } + + method = method->basemethod; + } + + wxLuaBindCFunc* bestFunc = NULL; // store the last function that worked. + + // Look at the available functions in parallel, per arg + for (arg = 0; (arg < argCount) && (funcArray.GetCount() != 0); arg++) + { + int arg_lua = arg+1+lua_argStart; // arg N in Lua + int ltype = lua_type(L, arg_lua); + + for (i = 0; i < (int)funcArray.GetCount(); i++) + { + wxLuaBindCFunc* func = (wxLuaBindCFunc*)funcArray[i]; + bestFunc = func; + invalidArg = arg; + + int arg_wxlua = arg; // arg N in wxLuaArgTag + + // does this method have any more arguments? + if (!func->argtags[arg_wxlua]) + { + funcArray.RemoveAt(i); + i--; + continue; + } + + // get argument tag id + int tag = (int)*(func->argtags[arg_wxlua]); + + //wxPrintf(wxT("ARG '%s' type %d argCount %d arg %d arg_lua %d arg_wxlua %d ltype %d wxtype %d func_count %d/%d\n"), lua2wx(wxlMethod->name).c_str(), func->type, argCount, arg, arg_lua, arg_wxlua, ltype, tag, i, funcArray.GetCount()); + + // Does the Lua type match the wxlua arg tag type + int is_ok = wxlua_iswxluatype(ltype, tag, L); + + // unknown/invalid standard wxlua arg type, check binding tag + if ((is_ok == -1) || ((is_ok == 0) && (tag == WXLUAARG_String))) + { + is_ok = (wxlua_isuserdatatype(L, arg_lua, tag) || + (tag == g_wxluatag_NULL)) ? 1 : 0; + } + + // this arg is not a match, remove this function as a possibility + if (is_ok == 0) + { + funcArray.RemoveAt(i); + i--; + continue; + } + } + } + + // If there was a function that matched run it, if > 1 ??? + // Note that the top function is the one that is highest in the + // derived functions from any baseclasses and should be the best choice. + if (funcArray.GetCount() > 0) + { + lua_CFunction func = ((wxLuaBindCFunc*)funcArray[0])->func; + + // successfully found overloaded function to handle wxLua call + return (*func)(L); + } + + lua_Debug ar; + lua_getstack(L, 0, &ar); + lua_getinfo(L, "n", &ar); + wxString name = lua2wx(ar.name); + + // Build an error message + wxString fnCall = name + wxT("("); + for (arg = 0; arg < argCount; arg++) + { + if (arg > 0) + fnCall += wxT(", "); + + int ltype = lua_type(L, arg+1+lua_argStart); + + if (ltype != LUA_TUSERDATA) + { + fnCall += lua_typename(L, ltype); + } + else + { + int tag = wxluaT_gettag(L, arg+1+lua_argStart); + fnCall += wxluaT_gettagname(L, tag); + } + } + fnCall += wxT(")"); + + + wxString fnOverloadList = wxT("wxLua Function Overload Table:\n"); + wxArrayString overloadMethodArray = wxlua_CreateMethodArgTagsMsg(L, wxlMethod); + for (i = 0; i < (int)overloadMethodArray.GetCount(); i++) + fnOverloadList += overloadMethodArray[i] + wxT("\n"); + + wxString errmsg; + + if (funcArray.GetCount() > 1) + { + errmsg = wxT("wxLua Overloaded function call is ambiguous.\nTry coercing values to proper types using tostring/number as appropriate.\n"); + } + + if (bestFunc == NULL) + errmsg += wxString::Format(wxT("wxLua overloaded function %s has invalid argument\n%s"), fnCall.c_str(), fnOverloadList.c_str()); + else + { + // We have to count the methods that are displayed to find the one that failed. + // Since we're failing anyway, we don't need this to be fast. + method = wxlMethod; + int i_func = 0; + bool found = false; + while (method && !found) + { + for (i = 0; i < method->funcs_n; ++i) + { + i_func++; + if (&method->funcs[i] == bestFunc) + { + found = true; + break; + } + } + + method = method->basemethod; + } + + errmsg += wxString::Format(wxT("wxLua overloaded function %s has invalid argument %d on method %02d\n%s"), fnCall.c_str(), (invalidArg), i_func, fnOverloadList.c_str()); + } + + wxlua_error(L, errmsg); + + return 0; + } + + wxArrayString wxlua_CreateMethodArgTagsMsg(lua_State* L, struct wxLuaBindMethod* wxlMethod) + { + wxArrayString overloadMethodArray; + wxCHECK_MSG(wxlMethod, overloadMethodArray, wxT("Invalid method table")); + + wxLuaState wxlState(L); + + int i_func = 0; // count total number of overloads + wxLuaBindMethod* method = wxlMethod; + + // traverse the methods down the baseclass methods if any + while (method) + { + wxLuaBindCFunc* funcs = method->funcs; + int i, arg, funcs_count = method->funcs_n; + wxString className; + + const wxLuaBindClass* wxlClass = wxlState.GetBindClass(method); + if (wxlClass) + className = lua2wx(wxlClass->name) + wxT("::"); + + for (i = 0; i < funcs_count; i++) + { + i_func++; + + wxString fnOverload = wxString::Format(wxT("%02d. %s%s("), i_func, className.c_str(), lua2wx(method->name).c_str()); + + // overloaded function has invalid tags + if (WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_OVERLOAD)) + { + // However, we do print that there is an overload so that in CallOverloadedFunction + // we can find what function we were closest too. + fnOverload += wxT(" ... ) - overloaded function"); + } + else + { + for (arg = 0; arg < funcs[i].maxargs; arg++) + { + // optional args? + if ((funcs[i].minargs < funcs[i].maxargs) && (arg == funcs[i].minargs)) + fnOverload += wxT("["); + + if (arg > 0) + fnOverload += wxT(", "); + + int tag = (int)*(funcs[i].argtags[arg]); + + fnOverload += wxluaT_gettagname(L, tag); + + if ((arg == 0) && + !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_STATIC) && + !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CONSTRUCTOR) && + !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CFUNCTION)) + fnOverload += wxT("(self)"); + } + + // close optional args + if (funcs[i].minargs < funcs[i].maxargs) + fnOverload += wxT("]"); + + fnOverload += wxT(")"); + + if (WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_STATIC)) + fnOverload += wxT(" - static"); + } + + overloadMethodArray.Add(fnOverload); + } + + method = method->basemethod; + } + + return overloadMethodArray; + } + //----------------------------------------------------------------------------- // wxLuaObject *************** *** 218,222 **** if ((m_reference != LUA_NOREF) && GetObject()) { ! m_wxlState->GetwxArrayInt(-1, *m_arrayInt); m_alloc_flag = wxLUAOBJECT_ARRAYINT; m_wxlState->lua_Pop(1); --- 465,469 ---- if ((m_reference != LUA_NOREF) && GetObject()) { ! *m_arrayInt = (wxArrayInt&)m_wxlState->GetwxArrayInt(-1); m_alloc_flag = wxLUAOBJECT_ARRAYINT; m_wxlState->lua_Pop(1); *************** *** 226,229 **** --- 473,559 ---- // ---------------------------------------------------------------------------- + // wxLuaSmartwxArrayString + // ---------------------------------------------------------------------------- + + class wxLuaSmartwxArrayStringRefData : public wxObjectRefData + { + public: + wxLuaSmartwxArrayStringRefData(wxArrayString* arr, int del) : m_arr(arr), m_delete(del) + { + if (!m_arr) { m_arr = new wxArrayString; m_delete = true; } // always exists + } + + virtual ~wxLuaSmartwxArrayStringRefData() { if (m_delete) delete m_arr; } + + wxArrayString *m_arr; + bool m_delete; + }; + + wxLuaSmartwxArrayString::wxLuaSmartwxArrayString(wxArrayString *arr, bool del) + { + m_refData = new wxLuaSmartwxArrayStringRefData(arr, del); + } + wxArrayString* wxLuaSmartwxArrayString::GetArray() const + { + return ((wxLuaSmartwxArrayStringRefData*)m_refData)->m_arr; + } + + // ---------------------------------------------------------------------------- + // wxLuaSmartwxSortedArrayString + // ---------------------------------------------------------------------------- + + class wxLuaSmartwxSortedArrayStringRefData : public wxObjectRefData + { + public: + wxLuaSmartwxSortedArrayStringRefData(wxSortedArrayString* arr, int del) : m_arr(arr), m_delete(del) + { + if (!m_arr) { m_arr = new wxSortedArrayString; m_delete = true; } // always exists + } + + virtual ~wxLuaSmartwxSortedArrayStringRefData() { if (m_delete) delete m_arr; } + + wxSortedArrayString *m_arr; + bool m_delete; + }; + + wxLuaSmartwxSortedArrayString::wxLuaSmartwxSortedArrayString(wxSortedArrayString *arr, bool del) + { + m_refData = new wxLuaSmartwxSortedArrayStringRefData(arr, del); + } + wxSortedArrayString* wxLuaSmartwxSortedArrayString::GetArray() const + { + return ((wxLuaSmartwxSortedArrayStringRefData*)m_refData)->m_arr; + } + + // ---------------------------------------------------------------------------- + // wxLuaSmartwxArrayInt + // ---------------------------------------------------------------------------- + + class wxLuaSmartwxArrayIntRefData : public wxObjectRefData + { + public: + wxLuaSmartwxArrayIntRefData(wxArrayInt* arr, int del) : m_arr(arr), m_delete(del) + { + if (!m_arr) { m_arr = new wxArrayInt; m_delete = true; } // always exists + } + + virtual ~wxLuaSmartwxArrayIntRefData() { if (m_delete) delete m_arr; } + + wxArrayInt *m_arr; + bool m_delete; + }; + + wxLuaSmartwxArrayInt::wxLuaSmartwxArrayInt(wxArrayInt *arr, bool del) + { + m_refData = new wxLuaSmartwxArrayIntRefData(arr, del); + } + + wxArrayInt* wxLuaSmartwxArrayInt::GetArray() const + { + return ((wxLuaSmartwxArrayIntRefData*)m_refData)->m_arr; + } + + + // ---------------------------------------------------------------------------- // wxlua_tableErrorHandler // ---------------------------------------------------------------------------- *************** *** 245,251 **** if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxluaT_gettag(L, 1) == *wxlClass->class_tag)) { - wxLuaState wxlState(L); - wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); - void* key = wxlua_touserdata(L, 1, true); --- 575,578 ---- *************** *** 254,258 **** // clean up the rest of this, this won't error if the key doesn't exist ! wxlState.RemoveTrackedObject(key, wxLuaState::DELETE_CLEAR_OBJECT); } --- 581,585 ---- // clean up the rest of this, this won't error if the key doesn't exist ! wxluaO_removetrackedobject(L, key, wxLUA_DELETE_CLEAR_OBJECT); } Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** wxlcallb.cpp 5 Dec 2007 05:54:11 -0000 1.46 --- wxlcallb.cpp 7 Dec 2007 02:13:14 -0000 1.47 *************** *** 29,33 **** wxWindowID win_id, wxWindowID last_id, wxEventType eventType, wxEvtHandler *evtHandler) ! : wxObject(), m_routine(0), m_wxlState(wxlState), m_evtHandler(evtHandler), m_id(win_id), m_last_id(last_id), m_wxlBindEvent(NULL) --- 29,33 ---- wxWindowID win_id, wxWindowID last_id, wxEventType eventType, wxEvtHandler *evtHandler) ! : m_routine(0), m_wxlState(wxlState), m_evtHandler(evtHandler), m_id(win_id), m_last_id(last_id), m_wxlBindEvent(NULL) *************** *** 70,78 **** } void wxLuaCallback::EventHandler(wxEvent& event) { // Get the wxLuaCallback to use, NOT "this" since "this" is a central event handler function wxLuaCallback *theCallback = (wxLuaCallback *)event.m_callbackUserData; - wxCHECK_RET(theCallback != NULL, wxT("Invalid wxLuaCallback in wxEvent user data")); --- 70,87 ---- } + wxString wxLuaCallback::GetInfo() const + { + return wxString::Format(wxT("%s(%d) -> wxLuaCallback(%p, ids %d, %d)|wxEvtHandler(%p) -> %s"), + lua2wx(m_wxlBindEvent ? m_wxlBindEvent->name : "?").c_str(), (int)GetEventType(), + this, m_id, m_last_id, + m_evtHandler, m_evtHandler->GetClassInfo()->GetClassName()); + } + void wxLuaCallback::EventHandler(wxEvent& event) { + wxEventType evtType = event.GetEventType(); + // Get the wxLuaCallback to use, NOT "this" since "this" is a central event handler function wxLuaCallback *theCallback = (wxLuaCallback *)event.m_callbackUserData; wxCHECK_RET(theCallback != NULL, wxT("Invalid wxLuaCallback in wxEvent user data")); *************** *** 81,96 **** if (wxlState.Ok()) { - wxEventType evtType = event.GetEventType(); - wxlState.SetInEventType(evtType); - theCallback->CallFunction(&event); - - // we want the wxLuaWinDestroyCallback to get this too - if (evtType == wxEVT_DESTROY) - event.Skip(); - wxlState.SetInEventType(wxEVT_NULL); } } --- 90,101 ---- if (wxlState.Ok()) { wxlState.SetInEventType(evtType); theCallback->CallFunction(&event); wxlState.SetInEventType(wxEVT_NULL); } + + // we want the wxLuaWinDestroyCallback to get this too + if (evtType == wxEVT_DESTROY) + event.Skip(); } *************** *** 158,162 **** wxLuaWinDestroyCallback::wxLuaWinDestroyCallback(const wxLuaState& wxlState, wxWindow* win, int iTag) ! :wxObject(), m_wxlState(wxlState), m_window(win) { wxCHECK_RET(m_wxlState.Ok(), wxT("Invalid wxLuaState")); --- 163,167 ---- wxLuaWinDestroyCallback::wxLuaWinDestroyCallback(const wxLuaState& wxlState, wxWindow* win, int iTag) ! :m_wxlState(wxlState), m_window(win) { wxCHECK_RET(m_wxlState.Ok(), wxT("Invalid wxLuaState")); *************** *** 179,182 **** --- 184,198 ---- } + wxString wxLuaWinDestroyCallback::GetInfo() const + { + wxString winName(wxT("wxWindow?")); + if (m_window && m_window->GetClassInfo() && m_window->GetClassInfo()->GetClassName()) + winName = m_window->GetClassInfo()->GetClassName(); + + return wxString::Format(wxT("%s(%p, id=%d)|wxLuaDestroyCallback(%p)"), + winName.c_str(), m_window, m_window ? m_window->GetId() : -1, + this); + } + void wxLuaWinDestroyCallback::EventHandler(wxWindowDestroyEvent& event) { *************** *** 203,207 **** wxluaO_cleartrackedmetatable(m_wxlState.GetLuaState(), m_window); // Now remove the object since it's gone ! m_wxlState.RemoveTrackedObject(m_window, wxLuaState::CLEAR_TRACKED_OBJECT|wxLuaState::CLEAR_DERIVED_METHODS); // Clear our own pointer to this window m_wxlState.RemoveTrackedWindow(m_window); --- 219,223 ---- wxluaO_cleartrackedmetatable(m_wxlState.GetLuaState(), m_window); // Now remove the object since it's gone ! m_wxlState.RemoveTrackedObject(m_window, wxLUA_CLEAR_TRACKED_OBJECT|wxLUA_CLEAR_DERIVED_METHODS); // Clear our own pointer to this window m_wxlState.RemoveTrackedWindow(m_window); *************** *** 241,245 **** } else ! lua_pop(L, 1); // pop value, lua_next will pop key at end } --- 257,261 ---- } else ! lua_pop(L, 1); // pop value, lua_next will pop key at end } Index: wxlua_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlua_bind.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** wxlua_bind.cpp 5 Dec 2007 05:54:11 -0000 1.12 --- wxlua_bind.cpp 7 Dec 2007 02:13:14 -0000 1.13 *************** *** 745,761 **** { wxLuaState wxlState(L); ! wxArrayString strArr = wxlState.GetTrackedCallbackStrings(); ! size_t n, count = strArr.GetCount(); ! long val = 0; ! lua_createtable(L, 0, count); ! ! for (n = 0; n < count; ++n) ! { ! lua_pushstring(L, wx2lua(strArr[n].BeforeFirst(wxT(' ')))); ! strArr[n].AfterLast(wxT(' ')).ToLong(&val); ! lua_pushnumber(L, (double)val); ! lua_rawset(L, -3); ! } ! return 1; } --- 745,749 ---- { wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedCallbackStrings()); return 1; } *************** *** 768,784 **** { wxLuaState wxlState(L); ! wxArrayString strArr = wxlState.GetTrackedWindowStrings(); ! size_t n, count = strArr.GetCount(); ! long val = 0; ! lua_createtable(L, 0, count); ! ! for (n = 0; n < count; ++n) ! { ! lua_pushstring(L, wx2lua(strArr[n].BeforeLast(wxT(' ')))); ! strArr[n].AfterLast(wxT(' ')).ToLong(&val); ! lua_pushnumber(L, (double)val); ! lua_rawset(L, -3); ! } ! return 1; } --- 756,760 ---- { wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedWindowStrings()); return 1; } *************** *** 791,807 **** { wxLuaState wxlState(L); ! wxArrayString strArr = wxlState.GetTrackedObjectStrings(); ! size_t n, count = strArr.GetCount(); ! long val = 0; ! lua_createtable(L, 0, count); ! ! for (n = 0; n < count; ++n) ! { ! lua_pushstring(L, wx2lua(strArr[n].BeforeLast(wxT(' ')))); ! strArr[n].AfterLast(wxT(' ')).ToLong(&val); ! lua_pushnumber(L, (double)val); ! lua_rawset(L, -3); ! } ! return 1; } --- 767,771 ---- { wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedObjectStrings()); return 1; } *************** *** 814,830 **** { wxLuaState wxlState(L); ! wxArrayString strArr = wxlState.GetTrackedWinDestroyCallbackStrings(); ! size_t n, count = strArr.GetCount(); ! long val = 0; ! lua_createtable(L, 0, count); ! ! for (n = 0; n < count; ++n) ! { ! lua_pushstring(L, wx2lua(strArr[n].BeforeLast(wxT(' ')))); ! strArr[n].AfterLast(wxT(' ')).ToLong(&val); ! lua_pushnumber(L, (double)val); ! lua_rawset(L, -3); ! } ! return 1; } --- 778,782 ---- { wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedWinDestroyCallbackStrings()); return 1; } |