From: John L. <jr...@us...> - 2007-08-07 20:23:29
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22233/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlcallb.cpp wxlstate.cpp Log Message: Add wxShutdown() Rename lua -> Lua Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** wxlstate.cpp 6 Aug 2007 22:00:34 -0000 1.129 --- wxlstate.cpp 7 Aug 2007 20:23:25 -0000 1.130 *************** *** 1,4 **** ///////////////////////////////////////////////////////////////////////////// ! // Purpose: wxWidgets interface to lua // Author: Ray Gilbert, John Labenski, J Winwood (Reuben Thomas for bitlib at bottom) // Created: 14/11/2001 --- 1,4 ---- ///////////////////////////////////////////////////////////////////////////// ! // Purpose: wxWidgets interface to Lua // Author: Ray Gilbert, John Labenski, J Winwood (Reuben Thomas for bitlib at bottom) // Created: 14/11/2001 *************** *** 35,42 **** wxLuaState wxNullLuaState(false); ! int LUACALL luaopen_bit(lua_State *L); // ---------------------------------------------------------------------------- ! // C functions for lua used in wxLuaState // ---------------------------------------------------------------------------- --- 35,42 ---- wxLuaState wxNullLuaState(false); ! int LUACALL luaopen_bit(lua_State *L); // implemented at bottom of file // ---------------------------------------------------------------------------- ! // C functions for Lua used in wxLuaState // ---------------------------------------------------------------------------- *************** *** 53,57 **** { // code copied from luaB_print in lbaselib.c ! if (i > 1) msg.Append(wxT("\t")); // lua uses a tab too in luaB_print const char *s; --- 53,57 ---- { // code copied from luaB_print in lbaselib.c ! if (i > 1) msg.Append(wxT("\t")); // Lua uses a tab too in luaB_print const char *s; *************** *** 68,86 **** msg += lua2wx(s); lua_pop(L, 1); /* pop result */ - /* - // we do this now in wxluabind__tostring_wxLuaBindClass - - // if we know the type, add it - if (lua_isuserdata(L, i) && wxlState.Ok()) - { - int nTag = wxlua_ttag(L, i); - if (nTag != WXLUA_NOTAG) - { - wxString name = wxlState.GetLuaTagName(nTag); - if (!name.IsEmpty()) - msg += wxString::Format(wxT(" (%s)"), name.c_str()); - } - } - */ } --- 68,71 ---- *************** *** 202,206 **** wxlState.SendEvent( event ); if (event.m_debug_hook_break) ! wxlState.terror("Interpreter stopped"); } --- 187,191 ---- wxlState.SendEvent( event ); if (event.m_debug_hook_break) ! wxlState.terror("Lua interpreter stopped."); } *************** *** 217,222 **** wxlState.SetLastLuaDebugHookTime( cur_time ); ! bool painting = false; wxLongToLongHashMap::iterator it; wxLongToLongHashMap* hashMap = &wxlState.GetLuaStateRefData()->m_wxlStateData->m_trackedObjects; --- 202,208 ---- wxlState.SetLastLuaDebugHookTime( cur_time ); ! bool painting = (evtType == wxEVT_PAINT); + /* wxLongToLongHashMap::iterator it; wxLongToLongHashMap* hashMap = &wxlState.GetLuaStateRefData()->m_wxlStateData->m_trackedObjects; *************** *** 230,233 **** --- 216,220 ---- } } + */ if (!painting) *************** *** 261,275 **** lua_pushvalue(L, stack_idx); // push a copy of value to store to top - int nTop = lua_gettop(L); // this is where the value is wxlua_pushkey_wxLuaReferences(L); // push name of table to get as key lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the refs table) ! lua_pushvalue(L, nTop); // push value to store int table_idx = luaL_ref(L, -2); // create unique integer reference // in our refs table ! lua_pop(L, 3); // pop value, table, value return table_idx; --- 248,261 ---- lua_pushvalue(L, stack_idx); // push a copy of value to store to top wxlua_pushkey_wxLuaReferences(L); // push name of table to get as key lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the refs table) ! lua_pushvalue(L, -2); // push value to store int table_idx = luaL_ref(L, -2); // create unique integer reference // in our refs table ! lua_pop(L, 3); // pop value, refs table, value return table_idx; *************** *** 340,344 **** { wxlua_pushkey_wxLuaObjects(L); ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the obj table) lua_pushlightuserdata(L, (void*)u); // key on Lua's userdata lua_rawget(L, -2); --- 326,330 ---- { wxlua_pushkey_wxLuaObjects(L); ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the obj table) lua_pushlightuserdata(L, (void*)u); // key on Lua's userdata lua_rawget(L, -2); *************** *** 371,375 **** lua_pushlightuserdata(L, (void*)u); // key on the object since we can reuse the userdata ! lua_pushvalue(L, -3); // push the lua userdata as the value (note: weak valued table) lua_rawset(L, -3); --- 357,361 ---- lua_pushlightuserdata(L, (void*)u); // key on the object since we can reuse the userdata ! lua_pushvalue(L, -3); // push the Lua userdata as the value (note: weak valued table) lua_rawset(L, -3); *************** *** 407,410 **** --- 393,397 ---- lua_pushlightuserdata(L, (void*)u); lua_rawget(L, -2); + if (lua_isuserdata(L, -1)) { *************** *** 439,443 **** { pdata = *ptr; // get the pointer the userdata holds ! if (null_ptr) // NULL ptr so lua won't try to gc it *ptr = NULL; } --- 426,430 ---- { pdata = *ptr; // get the pointer the userdata holds ! if (null_ptr) // NULL ptr so Lua won't try to gc it *ptr = NULL; } *************** *** 597,601 **** const wxLuaBindClass* wxlClass = (wxLuaBindClass *)lua_touserdata(L, -1); // actually lightuserdata ! lua_pop(L, 2); // pop wxLuaClasses table and lightuserdata return wxlClass; --- 584,588 ---- const wxLuaBindClass* wxlClass = (wxLuaBindClass *)lua_touserdata(L, -1); // actually lightuserdata ! lua_pop(L, 2); // pop wxLuaClasses table and lightuserdata (or nil if none) return wxlClass; *************** *** 792,801 **** } ! double num = 0; // we also allow 0 = false and !0 = true (Lua thinks 0 == true, i.e. !nil) if (l_type == LUA_TNUMBER) ! num = (double)lua_tonumber(L, stack_idx); else ! num = (double)lua_toboolean(L, stack_idx); return (num != 0); --- 779,788 ---- } ! int num = 0; // we also allow 0 = false and !0 = true (Lua thinks 0 == true, i.e. !nil) if (l_type == LUA_TNUMBER) ! num = (int)lua_tonumber(L, stack_idx); else ! num = (int)lua_toboolean(L, stack_idx); return (num != 0); *************** *** 1000,1004 **** lua_pop(L, 1); // pop the nil reg table wxlua_terror(L, "wxLua: The wxLuaDerivedMethods table in the registry is missing!"); - return false; } --- 987,990 ---- *************** *** 1267,1271 **** m_lua_State_coroutine(false), m_wxlStateData(NULL), ! m_own_stateData(true) { if (create_data) --- 1253,1257 ---- m_lua_State_coroutine(false), m_wxlStateData(NULL), ! m_own_stateData(false) { if (create_data) *************** *** 1338,1345 **** void wxLuaStateRefData::CleanupWxLua(bool closeLua) { - // from lua50/lib/lbaselib.c, the collectgarbage lua function - // see int luaB_collectgarbage(lua_State *L); - //lua_setgcthreshold(L, luaL_optint(L, 1, 0)); // = luaB_collectgarbage(L); - if (closeLua && (m_lua_State != NULL)) { --- 1324,1327 ---- *************** *** 1415,1419 **** return it->second; } ! else // it's a coroutine? look up the state data from lua { wxLuaStateRefData* d = NULL; --- 1397,1401 ---- return it->second; } ! else // it's a coroutine? look up the state data from Lua { wxLuaStateRefData* d = NULL; *************** *** 1661,1674 **** int wxLuaState::RunFile(const wxString &filename) { ! wxCHECK_MSG(Ok(), LUA_ERRRUN, wxT("lua interpreter not created")); ! wxCHECK_MSG(!M_WXLSTATEDATA->m_wxlStateData->m_is_running, LUA_ERRRUN, wxT("lua interpreter is already running")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; M_WXLSTATEDATA->m_wxlStateData->m_debug_hook_break = false; M_WXLSTATEDATA->m_wxlStateData->m_is_running = true; ! int top = lua_gettop(L); ! int status = luaL_loadfile(L, wx2lua(filename)); if (status == 0) { --- 1643,1654 ---- int wxLuaState::RunFile(const wxString &filename) { ! wxCHECK_MSG(Ok(), LUA_ERRRUN, wxT("Lua interpreter not created")); ! wxCHECK_MSG(!M_WXLSTATEDATA->m_wxlStateData->m_is_running, LUA_ERRRUN, wxT("Lua interpreter is already running")); M_WXLSTATEDATA->m_wxlStateData->m_debug_hook_break = false; M_WXLSTATEDATA->m_wxlStateData->m_is_running = true; ! int top = lua_GetTop(); ! int status = luaL_LoadFile(wx2lua(filename)); if (status == 0) { *************** *** 1696,1708 **** { wxCHECK_MSG(Ok(), LUA_ERRRUN, wxT("Invalid wxLuaState")); ! wxCHECK_MSG(!M_WXLSTATEDATA->m_wxlStateData->m_is_running, LUA_ERRRUN, wxT("lua interpreter is already running")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; M_WXLSTATEDATA->m_wxlStateData->m_debug_hook_break = false; M_WXLSTATEDATA->m_wxlStateData->m_is_running = true; ! int top = lua_gettop(L); ! int status = luaL_loadbuffer(L, (const char*)buf, size, wx2lua(name)); if (status == 0) { --- 1676,1686 ---- { wxCHECK_MSG(Ok(), LUA_ERRRUN, wxT("Invalid wxLuaState")); ! wxCHECK_MSG(!M_WXLSTATEDATA->m_wxlStateData->m_is_running, LUA_ERRRUN, wxT("Lua interpreter is already running")); M_WXLSTATEDATA->m_wxlStateData->m_debug_hook_break = false; M_WXLSTATEDATA->m_wxlStateData->m_is_running = true; ! int top = lua_GetTop(); ! int status = luaL_LoadBuffer((const char*)buf, size, wx2lua(name)); if (status == 0) { *************** *** 1885,1889 **** { wxCHECK_RET(Ok(), wxT("Invalid wxLuaState")); ! wxCHECK_RET(M_WXLSTATEDATA->m_wxlStateData->m_is_running, wxT("lua interpreter not running")); // Lua likes to be stopped within the debug hook, you get funny wxYield --- 1863,1867 ---- { wxCHECK_RET(Ok(), wxT("Invalid wxLuaState")); ! wxCHECK_RET(M_WXLSTATEDATA->m_wxlStateData->m_is_running, wxT("Lua interpreter not running")); // Lua likes to be stopped within the debug hook, you get funny wxYield *************** *** 2000,2004 **** lua_rawset( L, LUA_REGISTRYINDEX ); // set the value ! // Create a table for the userdata that we've pushed into lua // Use weak values so the gc works on them wxlua_pushkey_wxLuaObjects(L); --- 1978,1982 ---- lua_rawset( L, LUA_REGISTRYINDEX ); // set the value ! // Create a table for the userdata that we've pushed into Lua // Use weak values so the gc works on them wxlua_pushkey_wxLuaObjects(L); *************** *** 2116,2128 **** const wxLuaBindClass* wxlClass = NULL; wxlClass = GetLuaClass("wxEvent"); ! wxCHECK_RET(wxlClass, wxT("wxEvent lua tag is missing in wxLuaState, forgot to add wxWidgets binding?")); g_wxluatag_wxEvent = *wxlClass->class_tag; wxlClass = GetLuaClass("wxString"); ! wxCHECK_RET(wxlClass, wxT("wxString lua tag is missing in wxLuaState, forgot to add wxWidgets binding?")); g_wxluatag_wxString = *wxlClass->class_tag; wxlClass = GetLuaClass("wxWindow"); ! wxCHECK_RET(wxlClass, wxT("wxWindow lua tag is missing in wxLuaState, forgot to add wxWidgets binding?")); g_wxluatag_wxWindow = *wxlClass->class_tag; } --- 2094,2106 ---- const wxLuaBindClass* wxlClass = NULL; wxlClass = GetLuaClass("wxEvent"); ! wxCHECK_RET(wxlClass, wxT("wxEvent Lua tag is missing in wxLuaState, forgot to add wxWidgets binding?")); g_wxluatag_wxEvent = *wxlClass->class_tag; wxlClass = GetLuaClass("wxString"); ! wxCHECK_RET(wxlClass, wxT("wxString Lua tag is missing in wxLuaState, forgot to add wxWidgets binding?")); g_wxluatag_wxString = *wxlClass->class_tag; wxlClass = GetLuaClass("wxWindow"); ! wxCHECK_RET(wxlClass, wxT("wxWindow Lua tag is missing in wxLuaState, forgot to add wxWidgets binding?")); g_wxluatag_wxWindow = *wxlClass->class_tag; } *************** *** 2146,2152 **** wxCHECK_MSG(Ok(), NULL, wxT("Invalid wxLuaState")); ! // try to get the wxLuaBindClass from the lua registry table first ! lua_State* L = M_WXLSTATEDATA->m_lua_State; ! const wxLuaBindClass* wxlClass = wxlua_tgetclass(L, class_tag); // we shouldn't ever need this code --- 2124,2129 ---- wxCHECK_MSG(Ok(), NULL, wxT("Invalid wxLuaState")); ! // try to get the wxLuaBindClass from the Lua registry table first ! const wxLuaBindClass* wxlClass = wxlua_tgetclass(M_WXLSTATEDATA->m_lua_State, class_tag); // we shouldn't ever need this code *************** *** 2169,2175 **** { wxCHECK_MSG(GetRefData() != NULL, NULL, wxT("Invalid wxLuaState")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; ! return wxlua_tgetclass(L, className); } --- 2146,2150 ---- { wxCHECK_MSG(GetRefData() != NULL, NULL, wxT("Invalid wxLuaState")); ! return wxlua_tgetclass(M_WXLSTATEDATA->m_lua_State, className); } *************** *** 2206,2212 **** { wxCHECK_MSG(Ok(), -1, wxT("Invalid wxLuaState")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; ! return wxlua_isderivedclass(L, iClassTag, iBaseClassTag); } --- 2181,2185 ---- { wxCHECK_MSG(Ok(), -1, wxT("Invalid wxLuaState")); ! return wxlua_isderivedclass(M_WXLSTATEDATA->m_lua_State, iClassTag, iBaseClassTag); } *************** *** 2741,2745 **** } ! // push the object into lua by wrapping it with a Lua userdata // or if it's already wrapped, return a copy of the userdata wxlua_tpushusertag(L, data, tag, true); --- 2714,2718 ---- } ! // push the object into Lua by wrapping it with a Lua userdata // or if it's already wrapped, return a copy of the userdata wxlua_tpushusertag(L, data, tag, true); *************** *** 3031,3037 **** { wxCHECK_MSG(Ok() && pObject, false, wxT("Invalid wxLuaState or object to set derived method for.")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; ! return wxlua_setderivedmethod(L, pObject, method_name, wxlObj); } --- 3004,3008 ---- { wxCHECK_MSG(Ok() && pObject, false, wxT("Invalid wxLuaState or object to set derived method for.")); ! return wxlua_setderivedmethod(M_WXLSTATEDATA->m_lua_State, pObject, method_name, wxlObj); } *************** *** 3039,3045 **** { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; ! return wxlua_hasderivedmethod(L, pObject, method_name, push_method); } --- 3010,3014 ---- { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); ! return wxlua_hasderivedmethod(M_WXLSTATEDATA->m_lua_State, pObject, method_name, push_method); } *************** *** 3047,3053 **** { wxCHECK_MSG(Ok() && pObject, false, wxT("Invalid wxLuaState or object to remove.")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; ! return wxlua_removederivedmethod(L, pObject); } --- 3016,3020 ---- { wxCHECK_MSG(Ok() && pObject, false, wxT("Invalid wxLuaState or object to remove.")); ! return wxlua_removederivedmethod(M_WXLSTATEDATA->m_lua_State, pObject); } *************** *** 3069,3073 **** // ---------------------------------------------------------------------------- ! // Raw basic lua stack functions. int wxLuaState::lua_GetTop() const --- 3036,3040 ---- // ---------------------------------------------------------------------------- ! // Raw basic Lua stack functions. int wxLuaState::lua_GetTop() const *************** *** 3224,3228 **** // ---------------------------------------------------------------------------- ! // Raw lua push functions (C -> stack) void wxLuaState::lua_PushNil() --- 3191,3195 ---- // ---------------------------------------------------------------------------- ! // Raw Lua push functions (C -> stack) void wxLuaState::lua_PushNil() *************** *** 3268,3272 **** // ---------------------------------------------------------------------------- ! // Raw lua get functions (Lua -> stack) void wxLuaState::lua_GetTable(int idx) --- 3235,3239 ---- // ---------------------------------------------------------------------------- ! // Raw Lua get functions (Lua -> stack) void wxLuaState::lua_GetTable(int idx) *************** *** 3317,3321 **** // ----------------------------------------------------------------------- ! // Raw lua set functions (stack -> Lua) void wxLuaState::lua_SetTable(int idx) --- 3284,3288 ---- // ----------------------------------------------------------------------- ! // Raw Lua set functions (stack -> Lua) void wxLuaState::lua_SetTable(int idx) *************** *** 3351,3355 **** // ---------------------------------------------------------------------------- ! // Raw lua `load' and `call' functions (load and run Lua code) void wxLuaState::lua_Call(int nargs, int nresults) --- 3318,3322 ---- // ---------------------------------------------------------------------------- ! // Raw Lua `load' and `call' functions (load and run Lua code) void wxLuaState::lua_Call(int nargs, int nresults) *************** *** 3380,3384 **** // ---------------------------------------------------------------------------- ! // Raw lua coroutine functions int wxLuaState::lua_Yield(int nresults) --- 3347,3351 ---- // ---------------------------------------------------------------------------- ! // Raw Lua coroutine functions int wxLuaState::lua_Yield(int nresults) *************** *** 3399,3403 **** // ---------------------------------------------------------------------------- ! // Raw lua garbage-collection functions int wxLuaState::lua_GetGCCount() --- 3366,3370 ---- // ---------------------------------------------------------------------------- ! // Raw Lua garbage-collection functions int wxLuaState::lua_GetGCCount() *************** *** 3408,3412 **** // ---------------------------------------------------------------------------- ! // Raw lua miscellaneous functions wxString wxLuaState::lua_Version() const --- 3375,3379 ---- // ---------------------------------------------------------------------------- ! // Raw Lua miscellaneous functions wxString wxLuaState::lua_Version() const *************** *** 3431,3435 **** // ----------------------------------------------------------------------- ! // Raw lua some useful "macros", lua.h void wxLuaState::lua_Register(const char* funcName, lua_CFunction f) --- 3398,3402 ---- // ----------------------------------------------------------------------- ! // Raw Lua some useful "macros", lua.h void wxLuaState::lua_Register(const char* funcName, lua_CFunction f) *************** *** 3497,3501 **** // ---------------------------------------------------------------------------- ! // Raw lua Debug functions, lua.h int wxLuaState::lua_GetStack(int level, lua_Debug* ar) --- 3464,3468 ---- // ---------------------------------------------------------------------------- ! // Raw Lua Debug functions, lua.h int wxLuaState::lua_GetStack(int level, lua_Debug* ar) *************** *** 3552,3556 **** // ---------------------------------------------------------------------------- ! // Raw lua auxlib functions, lauxlib.h void wxLuaState::luaI_OpenLib(const char *libname, const luaL_reg *l, int nup) --- 3519,3523 ---- // ---------------------------------------------------------------------------- ! // Raw Lua auxlib functions, lauxlib.h void wxLuaState::luaI_OpenLib(const char *libname, const luaL_reg *l, int nup) *************** *** 3864,3868 **** } ! // Redirect lua function call to 1 method from a list of overloaded functions int LUACALL wxLuaState::CallOverloadedFunction(struct wxLuaBindMethod* wxlMethod) { --- 3831,3835 ---- } ! // Redirect Lua function call to 1 method from a list of overloaded functions int LUACALL wxLuaState::CallOverloadedFunction(struct wxLuaBindMethod* wxlMethod) { *************** *** 3872,3876 **** int invalidArg = 0; ! // get number of arguments called from lua int argCount = lua_GetTop(); int lua_argStart = 0; --- 3839,3843 ---- int invalidArg = 0; ! // get number of arguments called from Lua int argCount = lua_GetTop(); int lua_argStart = 0; *************** *** 3909,3913 **** for (arg = 0; (arg < argCount) && (funcArray.GetCount() != 0); arg++) { ! int arg_lua = arg+1+lua_argStart; // arg N in lua int ltype = lua_Type(arg_lua); --- 3876,3880 ---- for (arg = 0; (arg < argCount) && (funcArray.GetCount() != 0); arg++) { ! int arg_lua = arg+1+lua_argStart; // arg N in Lua int ltype = lua_Type(arg_lua); *************** *** 3933,3937 **** //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 = IswxLuaType(ltype, tag); --- 3900,3904 ---- //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 = IswxLuaType(ltype, tag); Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** wxlbind.cpp 3 Aug 2007 22:17:16 -0000 1.91 --- wxlbind.cpp 7 Aug 2007 20:23:25 -0000 1.92 *************** *** 110,114 **** delete m_arrayInt; ! // If a refererence exists, remove it, but don't bother if lua is being closed if ((m_reference != LUA_NOREF) && m_wxlState->Ok() && !m_wxlState->IsClosing()) m_wxlState->tremove(m_reference); --- 110,114 ---- delete m_arrayInt; ! // If a refererence exists, remove it, but don't bother if Lua is being closed if ((m_reference != LUA_NOREF) && m_wxlState->Ok() && !m_wxlState->IsClosing()) m_wxlState->tremove(m_reference); *************** *** 263,267 **** // The class to lookup is in an upvalue. (gettable tag method). // If the method is a function method push a wxLuaFunction object ! // onto the lua stack, setting its metatable so that when lua calls __call // the wxLuaFunction will run the actual method we set for it. // ---------------------------------------------------------------------------- --- 263,267 ---- // The class to lookup is in an upvalue. (gettable tag method). // If the method is a function method push a wxLuaFunction object ! // onto the Lua stack, setting its metatable so that when Lua calls __call // the wxLuaFunction will run the actual method we set for it. // ---------------------------------------------------------------------------- *************** *** 276,280 **** // See below, if _XXX is called then we set this flag so that // the called function knows to call the base class instead of recalling ! // the lua function and recursing. wxlua_setcallbaseclassfunction(L, false); --- 276,280 ---- // See below, if _XXX is called then we set this flag so that // the called function knows to call the base class instead of recalling ! // the Lua function and recursing. wxlua_setcallbaseclassfunction(L, false); *************** *** 288,292 **** { void *pObject = wxlua_ttouserdata(L, 1, false); ! name = lua_tostring(L, 2); // name of the __index method called in lua callbase = (name[0] == '_'); --- 288,292 ---- { void *pObject = wxlua_ttouserdata(L, 1, false); ! name = lua_tostring(L, 2); // name of the __index method called in Lua callbase = (name[0] == '_'); *************** *** 300,304 **** { found = true; ! result = 1; // the function for lua to call } } --- 300,304 ---- { found = true; ! result = 1; // the function for Lua to call } } *************** *** 447,451 **** // Use the pointer to this int as a special tag to know that __call has been // made on a table and that we want to remove the table for the bindings to ! // work. This is because lua always pushes the table on the stack if '.' or ':' // is used for the __call metamethod. // ---------------------------------------------------------------------------- --- 447,451 ---- // Use the pointer to this int as a special tag to know that __call has been // made on a table and that we want to remove the table for the bindings to ! // work. This is because Lua always pushes the table on the stack if '.' or ':' // is used for the __call metamethod. // ---------------------------------------------------------------------------- *************** *** 645,649 **** wxlState.tsettag(m_luaTable_tag); ! // prevent changes from lua scripts //wxlState.tsettagmethod(m_luaTable_tag, "__newindex", wxlua_tableErrorHandler); // FIXME allow this? } --- 645,649 ---- wxlState.tsettag(m_luaTable_tag); ! // prevent changes from Lua scripts //wxlState.tsettagmethod(m_luaTable_tag, "__newindex", wxlua_tableErrorHandler); // FIXME allow this? } *************** *** 682,686 **** void LUACALL wxLuaBinding::RegisterGeneratedClasses(const wxLuaState& wxlState_, int tableOffset, bool registerTypes) { ! // Replace the metatable functions for the classes we push into lua static const luaL_reg s_funcTable[] = { --- 682,686 ---- void LUACALL wxLuaBinding::RegisterGeneratedClasses(const wxLuaState& wxlState_, int tableOffset, bool registerTypes) { ! // Replace the metatable functions for the classes we push into Lua static const luaL_reg s_funcTable[] = { Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** wxlcallb.cpp 7 Aug 2007 03:06:12 -0000 1.40 --- wxlcallb.cpp 7 Aug 2007 20:23:25 -0000 1.41 *************** *** 50,54 **** } ! // create a reference to the lua event handler function if (lua_func_stack_idx != WXLUACALLBACK_NOROUTINE) m_routine = m_wxlState.tinsert(lua_func_stack_idx); --- 50,54 ---- } ! // create a reference to the Lua event handler function if (lua_func_stack_idx != WXLUACALLBACK_NOROUTINE) m_routine = m_wxlState.tinsert(lua_func_stack_idx); *************** *** 194,199 **** event.Skip(); ! // FIXME - Is it an error to receive an event after you've deleted lua? ! // probably not if lua is getting shutdown // Note: do not remove from wxLuaState's destroyHandlerList here, wait 'till destructor if (m_wxlState.Ok()) --- 194,199 ---- event.Skip(); ! // FIXME - Is it an error to receive an event after you've deleted Lua? ! // probably not if Lua is getting shutdown // Note: do not remove from wxLuaState's destroyHandlerList here, wait 'till destructor if (m_wxlState.Ok()) |