From: Andre A. <ar...@ki...> - 2012-06-07 14:09:40
|
using date:ParseDate(value, wx.wxString_const_iterator()) seems to work but looking into the run time we see that the pointer to the iterator is a bad pointer not very desirable. supporting a single argument seems preferable. The following code works. static int LUACALL wxLua_wxDateTime_ParseDate(lua_State *L) { // wxString date wxString date = wxlua_getwxStringtype(L, 2); // wxString::const_iterator end wxString::const_iterator * end; if (lua_type(L, 3) == LUA_TNONE) // missing argument end = &(wxString::const_iterator)date.end(); else end = (wxString::const_iterator *)wxluaT_getuserdatatype(L, 3, wxluatype_wxString_const_iterator); but a similar change would be needed for each function expecting an optional iterator. currently wxlua_getwxStringtype does not seem to handle a missing argument. If it returned NULL we could trigger on the result. maybe a special function end = GetOptionalIterator(L, 3, date); which returns the_iterator || &date.end() could be used. Andre |