From: John L. <jr...@us...> - 2007-12-07 06:45:15
|
Update of /cvsroot/wxlua/wxLua/bindings/wxlua In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv26745/wxLua/bindings/wxlua Modified Files: override.hpp Log Message: Rename wxlua_getwxstringtype wxlua_getwxStringtype to match other funcs. Fix bug (from w/ last commit) of using wrong key/value indexes in lua_next() loop Index: override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxlua/override.hpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** override.hpp 7 Dec 2007 02:13:09 -0000 1.11 --- override.hpp 7 Dec 2007 06:44:41 -0000 1.12 *************** *** 14,23 **** static int LUACALL wxLua_function_CompileLuaScript(lua_State *L) { - wxLuaState wxlState(L); int returns; // const wxString fileName ! const wxString fileName = wxlState.GetwxStringType(2); // const wxString luaScript ! const wxString luaScript = wxlState.GetwxStringType(1); wxString errMsg; int line_num = -1; --- 14,22 ---- static int LUACALL wxLua_function_CompileLuaScript(lua_State *L) { int returns; // const wxString fileName ! const wxString fileName = wxlua_getwxStringtype(L, 2); // const wxString luaScript ! const wxString luaScript = wxlua_getwxStringtype(L, 1); wxString errMsg; int line_num = -1; *************** *** 26,30 **** // push the result number lua_pushnumber(L, returns); ! wxlState.lua_PushString(errMsg); lua_pushnumber(L, line_num); return 3; --- 25,29 ---- // push the result number lua_pushnumber(L, returns); ! wxlua_pushwxString(L, errMsg); lua_pushnumber(L, line_num); return 3; *************** *** 76,81 **** static int LUACALL wxLua_function_type(lua_State *L) { - wxLuaState wxlState(L); - int ltype = lua_type(L, 1); const char* ltypename = lua_typename(L, ltype); --- 75,78 ---- *************** *** 91,95 **** wxluaarg_tag = wxlua_getwxluatype(ltype); ! wxString tagName = wxlState.GetLuaTagName(wxluaarg_tag); //wxlua_getwxluatypename(wxluaarg_tag); // push the results --- 88,92 ---- wxluaarg_tag = wxlua_getwxluatype(ltype); ! wxString tagName = wxluaT_gettagname(L, wxluaarg_tag); //wxlua_getwxluatypename(wxluaarg_tag); // push the results *************** *** 108,119 **** static int LUACALL wxLua_function_typename(lua_State *L) { - wxLuaState wxlState(L); wxString returns; // int wxluaarg_tag int wxluaarg_tag = (int)wxlua_getnumbertype(L, 1); // call wxlua_getwxluatypename ! returns = wxlState.GetLuaTagName(wxluaarg_tag); //wxlua_getwxluatypename(wxluaarg_tag); // push the result string ! wxlState.lua_PushString(returns); return 1; --- 105,115 ---- static int LUACALL wxLua_function_typename(lua_State *L) { wxString returns; // int wxluaarg_tag int wxluaarg_tag = (int)wxlua_getnumbertype(L, 1); // call wxlua_getwxluatypename ! returns = wxluaT_gettagname(L, wxluaarg_tag); //wxlua_getwxluatypename(wxluaarg_tag); // push the result string ! wxlua_pushwxString(L, returns); return 1; *************** *** 168,174 **** int LUACALL wxluabind_wxLuaBindCFunc__index(lua_State* L) { - wxLuaState wxlState(L); - wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); - void **ptr = (void **)lua_touserdata(L, 1); wxLuaBindCFunc* wxlCFunc= (wxLuaBindCFunc*)*ptr; --- 164,167 ---- *************** *** 252,258 **** int LUACALL wxluabind_wxLuaBindMethod__index(lua_State* L) { - wxLuaState wxlState(L); - wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); - void **ptr = (void **)lua_touserdata(L, 1); wxLuaBindMethod* wxlMethod = (wxLuaBindMethod*)*ptr; --- 245,248 ---- *************** *** 357,363 **** int LUACALL wxluabind_wxLuaBindClass__index(lua_State* L) { - wxLuaState wxlState(L); - wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); - void **ptr = (void **)lua_touserdata(L, 1); wxLuaBindClass* wxlClass = (wxLuaBindClass*)*ptr; --- 347,350 ---- *************** *** 419,426 **** if (wxlClass->classInfo) { ! const wxLuaBindClass* classInfoClass = wxlState.GetBindClass("wxClassInfo"); if (classInfoClass) { ! wxlState.PushUserDataType(*classInfoClass->class_tag, wxlClass->classInfo); return 1; } --- 406,413 ---- if (wxlClass->classInfo) { ! const wxLuaBindClass* classInfoClass = wxluaT_getclass(L, "wxClassInfo"); if (classInfoClass) { ! wxluaT_pushuserdatatype(L, *classInfoClass->class_tag, wxlClass->classInfo); return 1; } *************** *** 504,510 **** int LUACALL wxluabind_wxLuaBinding__index(lua_State* L) { - wxLuaState wxlState(L); - wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); - void **ptr = (void **)lua_touserdata(L, 1); wxLuaBinding* wxlBinding = (wxLuaBinding*)*ptr; --- 491,494 ---- *************** *** 687,693 **** lua_pushstring(L, "object"); if (wxlObject->objPtr != 0) ! wxlState.wxluaT_PushUserTag(wxlObject->objPtr, *wxlObject->class_tag, false); else ! wxlState.wxluaT_PushUserTag(*wxlObject->pObjPtr, *wxlObject->class_tag, false); lua_rawset(L, -3); --- 671,677 ---- lua_pushstring(L, "object"); if (wxlObject->objPtr != 0) ! wxluaT_pushusertag(L, wxlObject->objPtr, *wxlObject->class_tag, false); else ! wxluaT_pushusertag(L, *wxlObject->pObjPtr, *wxlObject->class_tag, false); lua_rawset(L, -3); *************** *** 718,728 **** wxluabind_removetableforcall(L); wxLuaState wxlState(L); wxLuaObject *returns; // call constructor returns = new wxLuaObject(wxlState, 1); // add to tracked memory list ! wxlState.AddTrackedObject(returns); // push the constructed class pointer ! wxlState.PushUserDataType(s_wxluatag_wxLuaObject, returns); // return the number of parameters return 1; --- 702,713 ---- wxluabind_removetableforcall(L); wxLuaState wxlState(L); + wxLuaObject *returns; // call constructor returns = new wxLuaObject(wxlState, 1); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer ! wxluaT_pushuserdatatype(L, s_wxluatag_wxLuaObject, returns); // return the number of parameters return 1; *************** *** 734,740 **** static int LUACALL wxLua_wxLuaObject_SetObject(lua_State *L) { - wxLuaState wxlState(L); // get this ! wxLuaObject *self = (wxLuaObject *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaObject); // call SetObject self->SetObject(1); --- 719,724 ---- static int LUACALL wxLua_wxLuaObject_SetObject(lua_State *L) { // get this ! wxLuaObject *self = (wxLuaObject *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLuaObject); // call SetObject self->SetObject(1); *************** *** 748,754 **** static int LUACALL wxLua_wxLuaObject_GetObject(lua_State *L) { - wxLuaState wxlState(L); // get this ! wxLuaObject *self = (wxLuaObject *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaObject); // call GetObject that push the item onto the stack, or nil if (self->GetObject()) --- 732,737 ---- static int LUACALL wxLua_wxLuaObject_GetObject(lua_State *L) { // get this ! wxLuaObject *self = (wxLuaObject *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLuaObject); // call GetObject that push the item onto the stack, or nil if (self->GetObject()) |