From: John L. <jr...@us...> - 2006-02-02 15:49:36
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31289/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp Log Message: separated wxSTC contrib from the wxWidgets binding, create new module for it Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** wxlbind.cpp 23 Jan 2006 19:38:30 -0000 1.13 --- wxlbind.cpp 2 Feb 2006 15:49:25 -0000 1.14 *************** *** 245,251 **** lua_State *L = wxlState.GetLuaState(); ! // create a global ! lua_pushstring(L, wx2lua(nameSpace)); ! lua_pushvalue(L, luaTable); lua_rawset(L, LUA_GLOBALSINDEX); lua_pop(L, 1); --- 245,257 ---- lua_State *L = wxlState.GetLuaState(); ! ! // create a global for the namespace if it doesn't already exist ! lua_getglobal(L, wx2lua(nameSpace)); ! if (!lua_istable(L, -1)) ! { ! lua_pushstring(L, wx2lua(nameSpace)); ! lua_pushvalue(L, luaTable); ! } ! lua_rawset(L, LUA_GLOBALSINDEX); lua_pop(L, 1); *************** *** 267,290 **** lua_State *L = wxlState.GetLuaState(); ! // create references table in registry ! tpushwxLuaReferences(L); ! lua_newtable(L); ! lua_rawset(L, LUA_REGISTRYINDEX); ! // create a tag for the wxLua table ! if (registerTypes) ! m_wxLuaTable = wxlState.tnewtag(); ! // create the wxLua table ! lua_newtable(L); ! int tableOffset = lua_gettop(L); ! // set the table tag ! wxlState.tsettag(m_wxLuaTable); ! // prevent changes from lua scripts ! //wxlState.tsettagmethod(m_wxLuaTable, "__newindex", wxLua_lua_tableErrorHandler); // FIXME allow this? ! // register all out classes etc. in the wxLua table RegisterGeneratedClasses(wxlState, tableOffset, registerTypes); --- 273,325 ---- lua_State *L = wxlState.GetLuaState(); ! int tableOffset = 0; ! // create a global for the namespace if it doesn't already exist ! lua_getglobal(L, wx2lua(nameSpace)); ! if (!lua_istable(L, -1)) ! { ! // pop the nil value ! lua_pop(L, 1); ! // create references table in registry ! tpushwxLuaReferences(L); ! lua_newtable(L); ! lua_rawset(L, LUA_REGISTRYINDEX); ! // create a tag for the wxLua table ! if (registerTypes) ! m_wxLuaTable = wxlState.tnewtag(); ! // create the wxLua table ! lua_newtable(L); ! tableOffset = lua_gettop(L); ! // set the table tag ! wxlState.tsettag(m_wxLuaTable); ! ! // prevent changes from lua scripts ! wxlState.tsettagmethod(m_wxLuaTable, "__newindex", wxLua_lua_tableErrorHandler); // FIXME allow this? ! } ! else ! { ! // leave the global table on the stack ! tableOffset = lua_gettop(L); ! ! // find the m_wxLuaTable of the previously loaded binding ! wxLuaBindingList::Node *node; ! for (node = wxLuaBinding::GetBindingList()->GetFirst(); node; node = node->GetNext() ) ! { ! wxLuaBinding* binding = node->GetData(); ! wxCHECK_MSG(binding != this, 0, wxT("Invalid binding order?")); ! ! if (binding->nameSpace == nameSpace) ! { ! m_wxLuaTable = binding->m_wxLuaTable; ! break; ! } ! } ! } ! ! // register all our classes etc. in the wxLua table RegisterGeneratedClasses(wxlState, tableOffset, registerTypes); |