Update of /cvsroot/wxlua/wxLua/modules/wxlua/src
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19898/wxLua/modules/wxlua/src
Modified Files:
wxlstate.cpp
Log Message:
Some comment cleanup
Document wxLuaState creation a little better
Index: wxlstate.cpp
===================================================================
RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v
retrieving revision 1.134
retrieving revision 1.135
diff -C2 -d -r1.134 -r1.135
*** wxlstate.cpp 14 Aug 2007 13:42:15 -0000 1.134
--- wxlstate.cpp 4 Sep 2007 22:21:10 -0000 1.135
***************
*** 1327,1330 ****
--- 1327,1332 ----
// NULL it's ref data.
// Note: even though the lua_State is closed the pointer value is still good.
+ // The wxLuaState we pushed into the reg table is a light userdata so
+ // it doesn't get deleted.
wxHashMapLuaState::iterator it = s_wxHashMapLuaState.find(m_lua_State);
if (it != s_wxHashMapLuaState.end())
***************
*** 1499,1507 ****
if (WXLUA_HASBIT(state_type, wxLUASTATE_GETSTATE))
{
Ref(wxLuaStateRefData::GetLuaState(L));
- return Ok();
}
!
! // state_type == wxLUASTATE_USESTATE or wxLUASTATE_SETSTATE
{
m_refData = new wxLuaStateRefData();
--- 1501,1508 ----
if (WXLUA_HASBIT(state_type, wxLUASTATE_GETSTATE))
{
+ // returns an invalid, wxNullLuaState on failure
Ref(wxLuaStateRefData::GetLuaState(L));
}
! else // state_type == wxLUASTATE_USESTATE or wxLUASTATE_SETSTATE
{
m_refData = new wxLuaStateRefData();
***************
*** 1510,1513 ****
--- 1511,1516 ----
M_WXLSTATEDATA->m_lua_State_static = WXLUA_HASBIT(state_type, wxLUASTATE_STATICSTATE);
+ // Create a new state to push into Lua, the last wxLuaStateRefData will delete it.
+ // Note: we call SetRefData() so that we don't increase the ref count.
wxLuaState* hashState = new wxLuaState(false);
hashState->SetRefData(m_refData);
***************
*** 1523,1527 ****
// register handlers to send events
RegisterFunction(wxlua_printFunction, "print");
- //RegisterFunction(wxlua_tracebackFunction, "debug.traceback");
// now register bindings
--- 1526,1529 ----
|